@Provider public class XMLEncoder extends Encoder implements javax.ws.rs.ext.MessageBodyWriter
${services_rest_encoders_XMLEncoder_Title}
${services_rest_encoders_XMLEncoder_Description}
Constructor and Description |
---|
XMLEncoder()
The Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List<MediaType> |
createSupportedMediaTypes()
${services_rest_encoders_XMLEncoder_method_createSupportedMediaTypes_Title}
|
protected javax.xml.transform.Transformer |
createTransformer()
Gets the XML converter The converter instance can handle XML from different sources and write the conversion output to various receivers.
|
long |
getSize(java.lang.Object arg0, java.lang.Class arg1, java.lang.reflect.Type arg2, java.lang.annotation.Annotation[] arg3, javax.ws.rs.core.MediaType arg4)
Determines the length of the object to be written after serialization.
|
boolean |
isWriteable(java.lang.Class arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3)
Determines whether the present expression supports the representation of the specified media type.
|
Representation |
toRepresentation(MediaType mediaType, java.lang.Object resourceObj)
${services_rest_encoders_XMLEncoder_method_toRepresentation_Title}
|
void |
writeTo(java.lang.Object arg0, java.lang.Class arg1, java.lang.reflect.Type arg2, java.lang.annotation.Annotation[] arg3, javax.ws.rs.core.MediaType arg4, javax.ws.rs.core.MultivaluedMap arg5, java.io.OutputStream arg6)
Generates an HTTP response for the specified media type.
|
getSupportedMediaTypes, isEncodeAllow
public boolean isWriteable(java.lang.Class arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3)
Determines whether the present expression supports the representation of the specified media type.
isWriteable
in interface javax.ws.rs.ext.MessageBodyWriter
arg0
- To generate an expression object.arg1
- Specifies the media type.arg2
- annotation array, the resource has these annotation methods to return to the object to be written.arg3
- The media type of the expected response.public long getSize(java.lang.Object arg0, java.lang.Class arg1, java.lang.reflect.Type arg2, java.lang.annotation.Annotation[] arg3, javax.ws.rs.core.MediaType arg4)
Determines the length of the object to be written after serialization. Is called before the HTTP response is generated.
getSize
in interface javax.ws.rs.ext.MessageBodyWriter
arg0
- To generate an expression object.arg1
- The Java class that corresponds to the object to be generated.arg2
- To generate an expression object type.arg2
- annotation array, the resource has these annotation methods to return to the object to be written.arg4
- HTTP The media type of the HTTP response.public void writeTo(java.lang.Object arg0, java.lang.Class arg1, java.lang.reflect.Type arg2, java.lang.annotation.Annotation[] arg3, javax.ws.rs.core.MediaType arg4, javax.ws.rs.core.MultivaluedMap arg5, java.io.OutputStream arg6) throws java.io.IOException, javax.ws.rs.WebApplicationException
Generates an HTTP response for the specified media type.
writeTo
in interface javax.ws.rs.ext.MessageBodyWriter
arg0
- To generate an expression object.arg1
- The Java class that corresponds to the object to be generated.arg2
- To generate an expression object type.arg2
- annotation array, the resource has these annotation methods to return to the object to be written.arg4
- HTTP The media type of the response.arg5
- HTTP Response to the message header.arg6
- HTTP Response.java.io.IOException
- When the read and write process is wrong.javax.ws.rs.WebApplicationException
- When the HTTP response fails.protected java.util.List<MediaType> createSupportedMediaTypes()
${services_rest_encoders_XMLEncoder_method_createSupportedMediaTypes_Title}
${services_rest_encoders_XMLEncoder_method_createSupportedMediaTypes_Description}
createSupportedMediaTypes
in class Encoder
public Representation toRepresentation(MediaType mediaType, java.lang.Object resourceObj)
${services_rest_encoders_XMLEncoder_method_toRepresentation_Title}
${services_rest_encoders_XMLEncoder_method_toRepresentation_Description}
toRepresentation
in class Encoder
mediaType
- ${services_rest_encoders_XMLEncoder_method_toRepresentation_param_mediaType}resourceObj
- ${services_rest_encoders_XMLEncoder_method_toRepresentation_param_resourceObj}protected javax.xml.transform.Transformer createTransformer() throws java.io.IOException
Gets the XML converter The converter instance can handle XML from different sources and write the conversion output to various receivers.
java.io.IOException
- The exception is thrown when an error occurs in the read and write process.