org.jboss.aerogear.controller.router.rest
Class JsonResponder
java.lang.Object
org.jboss.aerogear.controller.router.rest.AbstractRestResponder
org.jboss.aerogear.controller.router.rest.JsonResponder
- All Implemented Interfaces:
- Responder
public class JsonResponder
- extends AbstractRestResponder
A RESTFul Responder that is able to return JSON responses.
This implementation uses Jackson for JSON support.
|
Field Summary |
private org.codehaus.jackson.map.ObjectMapper |
mapper
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mapper
private final org.codehaus.jackson.map.ObjectMapper mapper
JsonResponder
public JsonResponder()
writeResponse
public void writeResponse(Object entity,
RouteContext routeContext)
throws Exception
- Description copied from class:
AbstractRestResponder
- Writes the passed-in entity to the
HttpServletResponse enabling concrete implementation to add additional headers
of in other ways process the response.
- Specified by:
writeResponse in class AbstractRestResponder
- Parameters:
entity - the entity returned from a Route endpoint.routeContext - the current RouteContext.
- Throws:
Exception - if an error occurs while responding.
writeJsonResponse
private void writeJsonResponse(Object entity,
RouteContext routeContext)
throws Exception
- Throws:
Exception
getMediaType
public MediaType getMediaType()
- Description copied from interface:
Responder
- The media type that this Responder can handle.
- Returns:
MediaType the media type.
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.