org.gcube.smartgears.extensions
Class HttpController

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.gcube.smartgears.extensions.HttpExtension
              extended by org.gcube.smartgears.extensions.HttpController
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, ApplicationExtension
Direct Known Subclasses:
RemoteResource

public class HttpController
extends HttpExtension

An HttpExtension that dispatches to one or more ApiResources, handling the generic, HTTP-aspects aspects of their client interactions

Author:
Fabio Simeoni
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.smartgears.extensions.HttpExtension
HttpExtension.Method
 
Constructor Summary
HttpController(String name, String mapping)
          Creates an instance with a given name and a given mapping.
 
Method Summary
 void addResources(ApiResource... resources)
          Adds one ore more ApiResources to this controller.
 Set<String> excludes()
          Returns the set of request paths that should be excluded from request management.
 void init(ApplicationContext context)
          Initialises the extensions with the context of the application.
 void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp)
           
 
Methods inherited from class org.gcube.smartgears.extensions.HttpExtension
context, init, mapping, mapping, name, name
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init
 

Constructor Detail

HttpController

public HttpController(String name,
                      String mapping)
Creates an instance with a given name and a given mapping.

Parameters:
name - the name
mapping - the mapping
Method Detail

addResources

public void addResources(ApiResource... resources)
Adds one ore more ApiResources to this controller.

Parameters:
resources - the resources

init

public void init(ApplicationContext context)
          throws Exception
Description copied from interface: ApplicationExtension
Initialises the extensions with the context of the application.

Specified by:
init in interface ApplicationExtension
Overrides:
init in class HttpExtension
Parameters:
context - the application context
Throws:
Exception - if the extension cannot be initialised

excludes

public Set<String> excludes()
Description copied from interface: ApplicationExtension
Returns the set of request paths that should be excluded from request management.

Specified by:
excludes in interface ApplicationExtension
Overrides:
excludes in class HttpExtension
Returns:
the set of request paths that should be excluded from request management

service

public final void service(javax.servlet.ServletRequest req,
                          javax.servlet.ServletResponse resp)
                   throws javax.servlet.ServletException,
                          IOException
Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException


Copyright © 2013. All Rights Reserved.