aerogear-controller 1.0.1

org.jboss.aerogear.controller.router
Class Responders

java.lang.Object
  extended by org.jboss.aerogear.controller.router.Responders

public class Responders
extends Object

Handles responding from a Route invocation by delegating to the appropriate Responder.

See Also:
Responder

Field Summary
private  Map<MediaType,Responder> responders
           
 
Constructor Summary
Responders(javax.enterprise.inject.Instance<Responder> responders)
           
 
Method Summary
private  boolean respond(MediaType mediaType, Object result, RouteContext routeContext)
           
 void respond(RouteContext routeContext, Object result)
          Responds to the Route in the passed-in RouteContext using an appropriate Responder.
private  void respondAny(Set<MediaType> mediaTypes, Object result, RouteContext routeContext)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

responders

private final Map<MediaType,Responder> responders
Constructor Detail

Responders

@Inject
public Responders(javax.enterprise.inject.Instance<Responder> responders)
Method Detail

respond

public void respond(RouteContext routeContext,
                    Object result)
             throws Exception
Responds to the Route in the passed-in RouteContext using an appropriate Responder.

The Responder used to respond is determined by inspecting the HTTP Accept header values and matching these with the media types that the Route is capable of producing (Route.produces())
If no match is found for the values in the Accept header, or if the Accept header was empty or "*/*" then any Responder that accepts "*/*" will be used to respond.

Parameters:
routeContext - the current route context
result - the result from invoking the Route's target endpoint method.
Throws:
Exception - if an exception is thrown while trying to respond.

respond

private boolean respond(MediaType mediaType,
                        Object result,
                        RouteContext routeContext)
                 throws Exception
Throws:
Exception

respondAny

private void respondAny(Set<MediaType> mediaTypes,
                        Object result,
                        RouteContext routeContext)
                 throws Exception
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object

aerogear-controller 1.0.1

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