aerogear-controller 1.0.1

org.jboss.aerogear.controller.router.rest
Class JsonResponder

java.lang.Object
  extended by org.jboss.aerogear.controller.router.rest.AbstractRestResponder
      extended by 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
           
 
Constructor Summary
JsonResponder()
           
 
Method Summary
 MediaType getMediaType()
          The media type that this Responder can handle.
private  void writeJsonResponse(Object entity, RouteContext routeContext)
           
 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.
 
Methods inherited from class org.jboss.aerogear.controller.router.rest.AbstractRestResponder
accepts, respond
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapper

private final org.codehaus.jackson.map.ObjectMapper mapper
Constructor Detail

JsonResponder

public JsonResponder()
Method Detail

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.

aerogear-controller 1.0.1

Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.