Class AbstractStaxProvider<T>
- java.lang.Object
-
- org.glassfish.admin.rest.provider.BaseProvider<T>
-
- org.glassfish.admin.rest.provider.AbstractStaxProvider<T>
-
- All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyWriter<T>
- Direct Known Subclasses:
CommandModelStaxProvider
public abstract class AbstractStaxProvider<T> extends BaseProvider<T>
Abstract implementation for entity writers to STaX API. This supports XML and JSON.- Since:
- 4.0
- Author:
- mmares
-
-
Field Summary
-
Fields inherited from class org.glassfish.admin.rest.provider.BaseProvider
desiredType, habitat, HEADER_DEBUG, JSONP_CALLBACK, requestHeaders, supportedMediaTypes, uriInfo
-
-
Constructor Summary
Constructors Constructor Description AbstractStaxProvider(Class desiredType, jakarta.ws.rs.core.MediaType... mediaType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetContent(T proxy)protected booleanisGivenTypeWritable(Class<?> type, Type genericType)Overwrite this if you need different test of type compatibility.protected abstract voidwriteContentToStream(T proxy, StreamWriter wr)Marshalling implementation here.voidwriteTo(T proxy, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream)Faster with direct stream writing-
Methods inherited from class org.glassfish.admin.rest.provider.BaseProvider
canShowDeprecatedItems, canShowHiddenCommands, getCallBackJSONP, getResourceLinks, getResourceLinks, getSize, getXmlCommandLinks, isDebug, isWriteable
-
-
-
-
Constructor Detail
-
AbstractStaxProvider
public AbstractStaxProvider(Class desiredType, jakarta.ws.rs.core.MediaType... mediaType)
-
-
Method Detail
-
isGivenTypeWritable
protected boolean isGivenTypeWritable(Class<?> type, Type genericType)
Description copied from class:BaseProviderOverwrite this if you need different test of type compatibility. Used from isWritable method.- Overrides:
isGivenTypeWritablein classBaseProvider<T>
-
writeContentToStream
protected abstract void writeContentToStream(T proxy, StreamWriter wr) throws Exception
Marshalling implementation here.- Parameters:
proxy- object to marshalwr- STaX for marshaling- Throws:
XMLStreamExceptionIOExceptionException
-
getContent
public String getContent(T proxy)
- Specified by:
getContentin classBaseProvider<T>
-
writeTo
public void writeTo(T proxy, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
Faster with direct stream writing- Specified by:
writeToin interfacejakarta.ws.rs.ext.MessageBodyWriter<T>- Overrides:
writeToin classBaseProvider<T>- Throws:
IOExceptionjakarta.ws.rs.WebApplicationException
-
-