Package play.server

Class ServletWrapper

  • All Implemented Interfaces:
    java.io.Serializable, java.util.EventListener, javax.servlet.Servlet, javax.servlet.ServletConfig, javax.servlet.ServletContextListener

    public class ServletWrapper
    extends javax.servlet.http.HttpServlet
    implements javax.servlet.ServletContextListener
    Servlet implementation. Thanks to Lee Breisacher.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      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

      Constructors 
      Constructor Description
      ServletWrapper()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void contextDestroyed​(javax.servlet.ServletContextEvent e)  
      void contextInitialized​(javax.servlet.ServletContextEvent e)  
      void copyResponse​(Http.Request request, Http.Response response, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)  
      void destroy()  
      protected static java.util.Map<java.lang.String,​Http.Cookie> getCookies​(javax.servlet.http.HttpServletRequest httpServletRequest)  
      protected static java.util.Map<java.lang.String,​Http.Header> getHeaders​(javax.servlet.http.HttpServletRequest httpServletRequest)  
      static boolean isGreaterThan​(javax.servlet.ServletContext context, int majorVersion, int minorVersion)  
      static boolean isModified​(java.lang.String etag, long last, javax.servlet.http.HttpServletRequest request)  
      static Http.Request parseRequest​(javax.servlet.http.HttpServletRequest httpServletRequest)  
      void serve404​(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, NotFound e)  
      void serve500​(java.lang.Exception e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      void serveStatic​(javax.servlet.http.HttpServletResponse servletResponse, javax.servlet.http.HttpServletRequest servletRequest, RenderStatic renderStatic)  
      protected void service​(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.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
      • 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​(javax.servlet.ServletContextEvent e)
        Specified by:
        contextInitialized in interface javax.servlet.ServletContextListener
      • contextDestroyed

        public void contextDestroyed​(javax.servlet.ServletContextEvent e)
        Specified by:
        contextDestroyed in interface javax.servlet.ServletContextListener
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Servlet
        Overrides:
        destroy in class javax.servlet.GenericServlet
      • isGreaterThan

        public static boolean isGreaterThan​(javax.servlet.ServletContext context,
                                            int majorVersion,
                                            int minorVersion)
      • service

        protected void service​(javax.servlet.http.HttpServletRequest httpServletRequest,
                               javax.servlet.http.HttpServletResponse httpServletResponse)
                        throws javax.servlet.ServletException,
                               java.io.IOException
        Overrides:
        service in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • serveStatic

        public void serveStatic​(javax.servlet.http.HttpServletResponse servletResponse,
                                javax.servlet.http.HttpServletRequest servletRequest,
                                RenderStatic renderStatic)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • isModified

        public static boolean isModified​(java.lang.String etag,
                                         long last,
                                         javax.servlet.http.HttpServletRequest request)
      • parseRequest

        public static Http.Request parseRequest​(javax.servlet.http.HttpServletRequest httpServletRequest)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getHeaders

        protected static java.util.Map<java.lang.String,​Http.Header> getHeaders​(javax.servlet.http.HttpServletRequest httpServletRequest)
      • getCookies

        protected static java.util.Map<java.lang.String,​Http.Cookie> getCookies​(javax.servlet.http.HttpServletRequest httpServletRequest)
      • serve404

        public void serve404​(javax.servlet.http.HttpServletRequest servletRequest,
                             javax.servlet.http.HttpServletResponse servletResponse,
                             NotFound e)
      • serve500

        public void serve500​(java.lang.Exception e,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
      • copyResponse

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