net.officefloor.plugin.servlet.container
Class HttpServletContainerImpl

java.lang.Object
  extended by net.officefloor.plugin.servlet.container.HttpServletContainerImpl
All Implemented Interfaces:
javax.servlet.FilterChain, HttpServletContainer, HttpServletServicer

public class HttpServletContainerImpl
extends Object
implements HttpServletContainer, HttpServletServicer, javax.servlet.FilterChain

HttpServletContainer implementation.

Author:
Daniel Sagenschneider

Constructor Summary
HttpServletContainerImpl(String servletName, javax.servlet.http.HttpServlet servlet, Map<String,String> initParameters, OfficeServletContext officeServletContext, Office office, Clock clock, Locale defaultLocale)
          Initiate.
 
Method Summary
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
           
 String[] getServletMappings()
           Obtains the mappings that are handled by this HttpServletServicer.
 String getServletName()
           Obtains the name of this HttpServletServicer.
 void include(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Includes the servicing of contained HttpServlet on the inputs.
 void include(OfficeServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Includes the content from this HttpServlet.
 void service(ServerHttpConnection connection, Map<String,Object> attributes, HttpSession session, HttpSecurity security, TaskContext<?,?,?> taskContext, ServicerMapping mapping)
          Services the HttpRequest of the ServerHttpConnection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpServletContainerImpl

public HttpServletContainerImpl(String servletName,
                                javax.servlet.http.HttpServlet servlet,
                                Map<String,String> initParameters,
                                OfficeServletContext officeServletContext,
                                Office office,
                                Clock clock,
                                Locale defaultLocale)
                         throws javax.servlet.ServletException
Initiate.

Parameters:
servletName - Name of the Servlet.
servlet - HttpServlet.
initParameters - Init parameters for the ServletConfig.
officeServletContext - OfficeServletContext.
office - Office.
clock - Clock.
defaultLocale - Default Locale.
Throws:
javax.servlet.ServletException - If fails to initialise the HttpServlet.
Method Detail

service

public void service(ServerHttpConnection connection,
                    Map<String,Object> attributes,
                    HttpSession session,
                    HttpSecurity security,
                    TaskContext<?,?,?> taskContext,
                    ServicerMapping mapping)
             throws javax.servlet.ServletException,
                    IOException
Description copied from interface: HttpServletContainer
Services the HttpRequest of the ServerHttpConnection.

Specified by:
service in interface HttpServletContainer
Parameters:
connection - ServerHttpConnection containing the HttpRequest to service.
attributes - Attributes in HttpRequest context.
session - HttpSession for the HttpRequest.
security - HttpSecurity. May be null if anonymous HttpRequest.
taskContext - TaskContext to allow access to OfficeFloor capabilities.
mapping - ServicerMapping that mapped the HttpRequest to the HttpServlet. May be null if not mapped.
Throws:
javax.servlet.ServletException - As per HttpServlet API.
IOException - As per HttpServlet API.

include

public void include(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws javax.servlet.ServletException,
                    IOException
Description copied from interface: HttpServletContainer
Includes the servicing of contained HttpServlet on the inputs.

Specified by:
include in interface HttpServletContainer
Parameters:
request - HttpServletRequest.
response - HttpServletResponse.
Throws:
javax.servlet.ServletException - As per HttpServlet API.
IOException - As per HttpServlet API.

getServletName

public String getServletName()
Description copied from interface: HttpServletServicer

Obtains the name of this HttpServletServicer.

This will be used to find this HttpServletServicer by name.

Specified by:
getServletName in interface HttpServletServicer
Returns:
HttpServletServicer name.

getServletMappings

public String[] getServletMappings()
Description copied from interface: HttpServletServicer

Obtains the mappings that are handled by this HttpServletServicer.

The mappings are of the form:

  1. /some/path.extension: for exact mapping (extension is optional)
  2. /wild/card/*: for path wild card mapping
  3. *.extension: for extension mapping

This follows the Servlet specification in regards to mappings.

Specified by:
getServletMappings in interface HttpServletServicer
Returns:
Mappings that are handled by this HttpServletServicer.
See Also:
ServicerMapper

include

public void include(OfficeServletContext context,
                    javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws javax.servlet.ServletException,
                    IOException
Description copied from interface: HttpServletServicer
Includes the content from this HttpServlet.

Specified by:
include in interface HttpServletServicer
Parameters:
context - OfficeServletContext.
request - HttpServletRequest.
response - HttpServletResponse.
Throws:
javax.servlet.ServletException - As per RequestDispatcher.
IOException - As per RequestDispatcher.

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response)
              throws IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.FilterChain
Throws:
IOException
javax.servlet.ServletException


Copyright © 2005-2012. All Rights Reserved.