Package io.dropwizard.jersey.errors
Class ErrorEntityWriter<T,U>
- java.lang.Object
-
- io.dropwizard.jersey.errors.ErrorEntityWriter<T,U>
-
- Type Parameters:
T- The entity type to handleU- The response type to produce
- All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyWriter<T>
public abstract class ErrorEntityWriter<T,U> extends Object implements jakarta.ws.rs.ext.MessageBodyWriter<T>
This class allows producing non-JSON responses for particular entities. For example, register an instance with theErrorMessageentity and the TEXT_HTML MediaType to produce custom HTML error messages.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedErrorEntityWriter(jakarta.ws.rs.core.MediaType contentType, Class<U> representation)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract UgetRepresentation(T entity)longgetSize(T entity, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)booleanisWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)voidwriteTo(T entity, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,Object> responseHeaders, OutputStream entityStream)
-
-
-
Method Detail
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
- Specified by:
isWriteablein interfacejakarta.ws.rs.ext.MessageBodyWriter<T>
-
getSize
public long getSize(T entity, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
- Specified by:
getSizein interfacejakarta.ws.rs.ext.MessageBodyWriter<T>
-
writeTo
public void writeTo(T entity, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,Object> responseHeaders, OutputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
- Specified by:
writeToin interfacejakarta.ws.rs.ext.MessageBodyWriter<T>- Throws:
IOExceptionjakarta.ws.rs.WebApplicationException
-
-