public abstract class AbstractRestResponder extends Object implements Responder
accepts(String) and making
sure that certain HTTP headers are always set on the HttpServletResponse, for example
that the 'Content-Type' header is set to the media type that this Responder accepts.| Constructor and Description |
|---|
AbstractRestResponder(MediaType mediaType)
Sole constructor that subclasses should call from tier no-args constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepts(String mediaType)
Determines whether this responder can respond to the passed-in @{code mediaType}
|
MediaType |
mediaType()
The media type that this Responder can handle.
|
void |
respond(Object entity,
RouteContext routeContext)
Responds to the current request in a why appropriate to the type of Responder (forward, return).
|
abstract void |
writeResponse(Object entity,
RouteContext routeContext)
Writes the passed-in entity to the
HttpServletResponse enabling concrete implementation
to add additional headers of in other ways process the response. |
private final MediaType mediaType
public AbstractRestResponder(MediaType mediaType)
mediaType - the media type that this responder accepts.public abstract void writeResponse(Object entity, RouteContext routeContext) throws Exception
HttpServletResponse enabling concrete implementation
to add additional headers of in other ways process the response.entity - the entity returned from a Route endpoint.routeContext - the current RouteContext.Exception - if an error occurs while responding.public boolean accepts(String mediaType)
Responderpublic void respond(Object entity, RouteContext routeContext) throws Exception
Responderrespond in interface Responderentity - the entity returned from a Route endpoint.routeContext - the current RouteContext.Exception - if an error occurs while responding.Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.