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 a instance with theErrorMessage
entity and the TEXT_HTML MediaType to produce custom HTML error messages.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ErrorEntityWriter(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 U
getRepresentation(T entity)
long
getSize(T entity, Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
boolean
isWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
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)
-
-
-
Method Detail
-
isWriteable
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
- Specified by:
isWriteable
in 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:
getSize
in 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:
writeTo
in interfacejakarta.ws.rs.ext.MessageBodyWriter<T>
- Throws:
IOException
jakarta.ws.rs.WebApplicationException
-
-