|
Restlet Framework 2.2.1 Java Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.StreamRepresentation
org.restlet.representation.OutputRepresentation
org.restlet.ext.jackson.JacksonRepresentation<T>
T
- The type to wrap.public class JacksonRepresentation<T>
Representation based on the Jackson library. It can serialize and deserialize
automatically in JSON, JSON binary (Smile), XML, YAML and CSV.
SECURITY WARNING: Using XML parsers configured to not prevent nor limit
document type definition (DTD) entity resolution can expose the parser to an
XML Entity Expansion injection attack.
Field Summary | |
---|---|
static boolean |
XML_EXPANDING_ENTITY_REFS
True for expanding entity references when parsing XML representations; default value provided by system property "org.restlet.ext.xml.expandingEntityRefs", false by default. |
static boolean |
XML_VALIDATING_DTD
True for validating DTD documents when parsing XML representations; default value provided by system property "org.restlet.ext.xml.validatingDtd", false by default. |
Fields inherited from class org.restlet.representation.Representation |
---|
UNKNOWN_SIZE |
Constructor Summary | |
---|---|
JacksonRepresentation(MediaType mediaType,
T object)
Constructor. |
|
JacksonRepresentation(Representation representation,
Class<T> objectClass)
Constructor. |
|
JacksonRepresentation(T object)
Constructor for the JSON media type. |
Method Summary | |
---|---|
protected com.fasterxml.jackson.dataformat.csv.CsvSchema |
createCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper)
Creates a Jackson CSV schema based on a mapper and the current object class. |
protected com.fasterxml.jackson.databind.ObjectMapper |
createObjectMapper()
Creates a Jackson object mapper based on a media type. |
protected com.fasterxml.jackson.databind.ObjectReader |
createObjectReader()
Creates a Jackson object reader based on a mapper. |
protected com.fasterxml.jackson.databind.ObjectWriter |
createObjectWriter()
Creates a Jackson object writer based on a mapper. |
com.fasterxml.jackson.dataformat.csv.CsvSchema |
getCsvSchema()
Returns the modifiable Jackson CSV schema. |
T |
getObject()
Returns the wrapped object, deserializing the representation with Jackson if necessary. |
Class<T> |
getObjectClass()
Returns the object class to instantiate. |
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Returns the modifiable Jackson object mapper. |
com.fasterxml.jackson.databind.ObjectReader |
getObjectReader()
Returns the modifiable Jackson object reader. |
com.fasterxml.jackson.databind.ObjectWriter |
getObjectWriter()
Returns the modifiable Jackson object writer. |
boolean |
isExpandingEntityRefs()
Indicates if the parser will expand entity reference nodes. |
boolean |
isValidatingDtd()
Indicates the desire for validating this type of XML representations against an XML schema if one is referenced within the contents. |
void |
setCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvSchema csvSchema)
Sets the Jackson CSV schema. |
void |
setExpandingEntityRefs(boolean expandEntityRefs)
Indicates if the parser will expand entity reference nodes. |
void |
setObject(T object)
Sets the object to format. |
void |
setObjectClass(Class<T> objectClass)
Sets the object class to instantiate. |
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Sets the Jackson object mapper. |
void |
setObjectReader(com.fasterxml.jackson.databind.ObjectReader objectReader)
Sets the Jackson object reader. |
void |
setObjectWriter(com.fasterxml.jackson.databind.ObjectWriter objectWriter)
Sets the Jackson object writer. |
void |
setValidatingDtd(boolean validating)
Indicates the desire for validating this type of XML representations against an XML schema if one is referenced within the contents. |
void |
write(OutputStream outputStream)
|
Methods inherited from class org.restlet.representation.OutputRepresentation |
---|
getChannel, getStream |
Methods inherited from class org.restlet.representation.StreamRepresentation |
---|
getReader, write, write |
Methods inherited from class org.restlet.representation.Representation |
---|
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient |
Methods inherited from class org.restlet.representation.RepresentationInfo |
---|
getModificationDate, getTag, setModificationDate, setTag |
Methods inherited from class org.restlet.representation.Variant |
---|
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean XML_EXPANDING_ENTITY_REFS
public static boolean XML_VALIDATING_DTD
Constructor Detail |
---|
public JacksonRepresentation(MediaType mediaType, T object)
mediaType
- The target media type.object
- The object to format.public JacksonRepresentation(Representation representation, Class<T> objectClass)
representation
- The representation to parse.objectClass
- The object class to instantiate.public JacksonRepresentation(T object)
object
- The object to format.Method Detail |
---|
protected com.fasterxml.jackson.dataformat.csv.CsvSchema createCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvMapper csvMapper)
csvMapper
- The source CSV mapper.
protected com.fasterxml.jackson.databind.ObjectMapper createObjectMapper()
protected com.fasterxml.jackson.databind.ObjectReader createObjectReader()
protected com.fasterxml.jackson.databind.ObjectWriter createObjectWriter()
public com.fasterxml.jackson.dataformat.csv.CsvSchema getCsvSchema()
public T getObject() throws IOException
IOException
public Class<T> getObjectClass()
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public com.fasterxml.jackson.databind.ObjectReader getObjectReader()
public com.fasterxml.jackson.databind.ObjectWriter getObjectWriter()
public boolean isExpandingEntityRefs()
public boolean isValidatingDtd()
public void setCsvSchema(com.fasterxml.jackson.dataformat.csv.CsvSchema csvSchema)
csvSchema
- The Jackson CSV schema.public void setExpandingEntityRefs(boolean expandEntityRefs)
expandEntityRefs
- True if the parser will expand entity reference nodes.public void setObject(T object)
object
- The object to format.public void setObjectClass(Class<T> objectClass)
objectClass
- The object class to instantiate.public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper
- The Jackson object mapper.public void setObjectReader(com.fasterxml.jackson.databind.ObjectReader objectReader)
objectReader
- The Jackson object reader.public void setObjectWriter(com.fasterxml.jackson.databind.ObjectWriter objectWriter)
objectWriter
- The Jackson object writer.public void setValidatingDtd(boolean validating)
validating
- The new validation flag to set.public void write(OutputStream outputStream) throws IOException
write
in class Representation
IOException
|
Restlet Framework 2.2.1 Java Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |