org.jboss.aerogear.controller.router
Class Responders
java.lang.Object
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
responders
private final Map<MediaType,Responder> responders
Responders
@Inject
public Responders(javax.enterprise.inject.Instance<Responder> responders)
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 contextresult - 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
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.