play.server
Class ServletWrapper

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by play.server.ServletWrapper
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, Servlet, ServletConfig, ServletContextListener

public class ServletWrapper
extends HttpServlet
implements ServletContextListener

Servlet implementation. Thanks to Lee Breisacher.

See Also:
Serialized Form

Nested Class Summary
 class ServletWrapper.ServletInvocation
           
 
Field Summary
static java.lang.String IF_MODIFIED_SINCE
           
static java.lang.String IF_NONE_MATCH
           
static java.lang.String SERVLET_REQ
          Constant for accessing the underlying HttpServletRequest from Play's Request in a Servlet based deployment.
static java.lang.String SERVLET_RES
          Constant for accessing the underlying HttpServletResponse from Play's Request in a Servlet based deployment.
 
Constructor Summary
ServletWrapper()
           
 
Method Summary
 void contextDestroyed(ServletContextEvent e)
           
 void contextInitialized(ServletContextEvent e)
           
 void copyResponse(Http.Request request, Http.Response response, HttpServletRequest servletRequest, HttpServletResponse servletResponse)
           
 void destroy()
           
protected static java.util.Map<java.lang.String,Http.Cookie> getCookies(HttpServletRequest httpServletRequest)
           
protected static java.util.Map<java.lang.String,Http.Header> getHeaders(HttpServletRequest httpServletRequest)
           
static boolean isGreaterThan(ServletContext context, int majorVersion, int minorVersion)
           
static boolean isModified(java.lang.String etag, java.lang.String lastDate, HttpServletRequest request)
           
static Http.Request parseRequest(HttpServletRequest httpServletRequest)
           
 void serve404(HttpServletRequest servletRequest, HttpServletResponse servletResponse, NotFound e)
           
 void serve500(java.lang.Exception e, HttpServletRequest request, HttpServletResponse response)
           
 void serveStatic(HttpServletResponse servletResponse, HttpServletRequest servletRequest, RenderStatic renderStatic)
           
protected  void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IF_MODIFIED_SINCE

public static final java.lang.String IF_MODIFIED_SINCE
See Also:
Constant Field Values

IF_NONE_MATCH

public static final java.lang.String IF_NONE_MATCH
See Also:
Constant Field Values

SERVLET_REQ

public static final java.lang.String SERVLET_REQ
Constant for accessing the underlying HttpServletRequest from Play's Request in a Servlet based deployment.

Sample usage:

HttpServletRequest req = Request.current().args.get(ServletWrapper.SERVLET_REQ);

See Also:
Constant Field Values

SERVLET_RES

public static final java.lang.String SERVLET_RES
Constant for accessing the underlying HttpServletResponse from Play's Request in a Servlet based deployment.

Sample usage:

HttpServletResponse res = Request.current().args.get(ServletWrapper.SERVLET_RES);

See Also:
Constant Field Values
Constructor Detail

ServletWrapper

public ServletWrapper()
Method Detail

contextInitialized

public void contextInitialized(ServletContextEvent e)
Specified by:
contextInitialized in interface ServletContextListener

contextDestroyed

public void contextDestroyed(ServletContextEvent e)
Specified by:
contextDestroyed in interface ServletContextListener

destroy

public void destroy()
Specified by:
destroy in interface Servlet
Overrides:
destroy in class GenericServlet

isGreaterThan

public static boolean isGreaterThan(ServletContext context,
                                    int majorVersion,
                                    int minorVersion)

service

protected void service(HttpServletRequest httpServletRequest,
                       HttpServletResponse httpServletResponse)
                throws ServletException,
                       java.io.IOException
Overrides:
service in class HttpServlet
Throws:
ServletException
java.io.IOException

serveStatic

public void serveStatic(HttpServletResponse servletResponse,
                        HttpServletRequest servletRequest,
                        RenderStatic renderStatic)
                 throws java.io.IOException
Throws:
java.io.IOException

isModified

public static boolean isModified(java.lang.String etag,
                                 java.lang.String lastDate,
                                 HttpServletRequest request)

parseRequest

public static Http.Request parseRequest(HttpServletRequest httpServletRequest)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

getHeaders

protected static java.util.Map<java.lang.String,Http.Header> getHeaders(HttpServletRequest httpServletRequest)

getCookies

protected static java.util.Map<java.lang.String,Http.Cookie> getCookies(HttpServletRequest httpServletRequest)

serve404

public void serve404(HttpServletRequest servletRequest,
                     HttpServletResponse servletResponse,
                     NotFound e)

serve500

public void serve500(java.lang.Exception e,
                     HttpServletRequest request,
                     HttpServletResponse response)

copyResponse

public void copyResponse(Http.Request request,
                         Http.Response response,
                         HttpServletRequest servletRequest,
                         HttpServletResponse servletResponse)
                  throws java.io.IOException
Throws:
java.io.IOException


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly