com.continuuity.http
Interface HttpHandler

All Known Implementing Classes:
AbstractHttpHandler, HttpResourceHandler

public interface HttpHandler

Interface that needs to be implemented for handling HTTP methods. init and destroy methods can be used to manage the lifecycle of the object. The framework will call init and destroy during startup and shutdown respectively. No handles will be called before init method of the class is called or after the destroy method is called. The handlers should be annotated with Jax-RS annotations to handle appropriate path and HTTP Methods. Note: Only the annotations in the given handler object will be inspected and be available for routing. The annotations from the base class (if extended) will not be applied to the given handler object. Note: The framework that calls the handler assumes that the implementation is threadsafe. Note: If the HttpHandler implementation is extended, the annotations are not inherited from the base class. Example: public class ApiHandler implements HttpHandler{ @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 before the server shuts down. } @Path("/common/v1/widgets") @GET public void handleGet(HttpRequest request, HttpResponder responder){ //Handle Http request } }


Method Summary
 void destroy(HandlerContext context)
          destroy method will be called before shutdown.
 void init(HandlerContext context)
          init method will be called before the netty pipeline is setup.
 

Method Detail

init

void init(HandlerContext context)
init method will be called before the netty pipeline is setup. Any initialization operation can be performed in this method.

Parameters:
context - instance of HandlerContext.

destroy

void destroy(HandlerContext context)
destroy method will be called before shutdown. Any teardown task can be performed in this method. At this point the server will not accept any more new requests.

Parameters:
context - instance of HandlerContext.


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