public class JObjectHttpMessageConverter extends AbstractHttpMessageConverter<JObject>
HttpMessageConverter
capable of
encoding and decoding one or more JObject
s contained in a SnapshotJTransaction
.
The payload MIME type is set to application/x-permazen-transaction
with an additional root
parameter specifying the root JObject
in the encoded transaction.
There may of course be arbitrarily many other supporting JObject
s riding along with it.
Validation of all incoming objects is supported; see setValidationGroups()
.
Modifier and Type | Field and Description |
---|---|
static String |
ROOT_OBJECT_ID_PARAMETER_NAME
Name of the object ID parameter incluced in the MIME type.
|
logger
Constructor and Description |
---|
JObjectHttpMessageConverter(Permazen jdb)
Constructor.
|
JObjectHttpMessageConverter(Permazen jdb,
MediaType... supportedMediaTypes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(Class<?> clazz,
MediaType mediaType) |
protected Long |
getContentLength(JObject jobj,
MediaType contentType) |
protected MediaType |
getDefaultContentType(JObject jobj) |
protected JObject |
readInternal(Class<? extends JObject> type,
HttpInputMessage input) |
void |
setValidationGroups(Class<?>... groups)
Set validation groups used to validate all incoming objects.
|
protected boolean |
supports(Class<?> target) |
protected void |
writeInternal(JObject jobj,
HttpOutputMessage output) |
addDefaultHeaders, canRead, canWrite, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSupportedMediaTypes
public static final String ROOT_OBJECT_ID_PARAMETER_NAME
public JObjectHttpMessageConverter(Permazen jdb)
jdb
- Permazen
instanceIllegalArgumentException
- if jdb
is nullpublic JObjectHttpMessageConverter(Permazen jdb, MediaType... supportedMediaTypes)
jdb
- Permazen
instancesupportedMediaTypes
- supported media typesIllegalArgumentException
- if jdb
is nullpublic void setValidationGroups(Class<?>... groups)
If set to null, no validation is performed; this is the default behavior.
Otherwise, validation of all incoming objects (not just the root object) is performed using the specified
validation groups, or Default
if an empty array is specified.
groups
- validation group(s) to use for validation; if empty, Default
is assumed;
if null, no validation is performedprotected Long getContentLength(JObject jobj, MediaType contentType)
getContentLength
in class AbstractHttpMessageConverter<JObject>
public boolean canRead(Class<?> clazz, MediaType mediaType)
canRead
in interface HttpMessageConverter<JObject>
canRead
in class AbstractHttpMessageConverter<JObject>
protected boolean supports(Class<?> target)
supports
in class AbstractHttpMessageConverter<JObject>
protected MediaType getDefaultContentType(JObject jobj)
getDefaultContentType
in class AbstractHttpMessageConverter<JObject>
protected JObject readInternal(Class<? extends JObject> type, HttpInputMessage input) throws IOException
readInternal
in class AbstractHttpMessageConverter<JObject>
IOException
protected void writeInternal(JObject jobj, HttpOutputMessage output) throws IOException
writeInternal
in class AbstractHttpMessageConverter<JObject>
IOException
Copyright © 2022. All rights reserved.