Package com.continuuity.http

Service and components to build Netty based Http web service.

See:
          Description

Interface Summary
HandlerContext Place holder for information about the environment.
HandlerHook Interface that needs to be implemented to intercept handler method calls.
HttpHandler Interface that needs to be implemented for handling HTTP methods.
HttpResponder HttpResponder is used to send response back to clients.
InternalHttpResponse Interface used to get the status code and content from calling another handler internally.
URLRewriter Re-writes URL of an incoming request before any handlers or their hooks are called.
 

Class Summary
AbstractHandlerHook A base implementation of HandlerHook that provides no-op for both HandlerHook.preCall(org.jboss.netty.handler.codec.http.HttpRequest, HttpResponder, HandlerInfo) and HandlerHook.postCall(org.jboss.netty.handler.codec.http.HttpRequest, org.jboss.netty.handler.codec.http.HttpResponseStatus, HandlerInfo) methods.
AbstractHttpHandler A base implementation of HttpHandler that provides a method for sending a request to other handlers that exist in the same server.
BasicHandlerContext BasicHandlerContext returns an empty runtime arguments.
BasicHttpResponder HttpResponder responds back to the client that initiated the request.
BasicInternalHttpResponse Class that stores the response body in memory or as a file.
BodyConsumer HttpHandler would extend this abstract class and implement methods to stream the body directly.
HandlerInfo Contains information about HttpHandler method.
HttpDispatcher HttpDispatcher that invokes the appropriate http-handler method.
HttpResourceHandler HttpResourceHandler handles the http request.
HttpResourceModel HttpResourceModel contains information needed to handle Http call for a given path.
InternalHttpResponder InternalHttpResponder is used when a handler is being called internally by some other handler, and thus there is no need to go through the network.
NettyHttpService Webservice implemented using the netty framework.
NettyHttpService.Builder Builder to help create the NettyHttpService.
PatternPathRouterWithGroups<T> Matches incoming un-matched paths to destinations.
PatternPathRouterWithGroups.RoutableDestination<T> Represents a matched destination.
RequestRouter RequestRouter that uses HttpMethodHandler to determine the http-handler method Signature of http request.
 

Package com.continuuity.http Description

Service and components to build Netty based Http web service. NettyHttpService sets up the necessary pipeline and manages starting, stopping, state-management of the web service. In-order to handle http requests, HttpHandler must be implemented. The methods in the classes implemented from HttpHandler must be annotated with Jersey annotations to specify http uri paths and http methods. Note: Only supports the following annotations: Path, PathParams, GET, PUT, POST, DELETE. Note: Doesn't support getting Annotations from base class if the HttpHandler implements also extends a class with annotation. Sample usage Handlers and Netty service setup. //Setup Handlers @Path("/common/v1/") public class ApiHandler implements HttpHandler{ @Path("widgets") @GET public void widgetHandler(HttpRequest request, HttpResponder responder){ responder.sendJson(HttpResponseStatus.OK, "{\"key\": \"value\"}"); } @Override public void init(HandlerContext context){ //Perform bootstrap operations before any of the handlers in this class gets called. } @Override public void destroy(HandlerContext context){ //Perform teardown operations the server shuts down. } } //Set up and build Netty pipeline List handlers = Lists.newArrayList(); handlers.add(new Handler()); NettyHttpService.Builder builder = NettyHttpService.builder(); builder.addHttpHandlers(handlers); builder.setPort(8989); Channel service = builder.build(); service.startAndWait(); //Stop the web-service service.shutdown();



Copyright 2013 Continuuity, Inc. Licensed under the Apache License, Version 2.0