Class TExtensibleServlet

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

    public abstract class TExtensibleServlet
    extends javax.servlet.http.HttpServlet
    Servlet implementation class ThriftServer, that allows TProcessor and TProtocolFactory to be supplied after the GenericServlet.init() method has finished.
    Subclasses must implement the abstract methods that return the TProcessor and two TProtocolFactory. Those methods are guaranteed to be called exactly once, and that ServletContext is available.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addCustomHeader​(java.lang.String key, java.lang.String value)  
      protected void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      protected void doPost​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      protected abstract TProtocolFactory getInProtocolFactory()
      Returns the appropriate in TProtocolFactory.
      protected abstract TProtocolFactory getOutProtocolFactory()
      Returns the appropriate out TProtocolFactory.
      protected abstract TProcessor getProcessor()
      Returns the appropriate TProcessor.
      void init​(javax.servlet.ServletConfig config)  
      void setCustomHeaders​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> headers)  
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, 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
    • Constructor Detail

      • TExtensibleServlet

        public TExtensibleServlet()
    • Method Detail

      • getProcessor

        protected abstract TProcessor getProcessor()
        Returns the appropriate TProcessor. This will be called once just after the GenericServlet.init() method
        Returns:
        the appropriate TProcessor
      • getInProtocolFactory

        protected abstract TProtocolFactory getInProtocolFactory()
        Returns the appropriate in TProtocolFactory. This will be called once just after the GenericServlet.init() method
        Returns:
        the appropriate in TProtocolFactory
      • getOutProtocolFactory

        protected abstract TProtocolFactory getOutProtocolFactory()
        Returns the appropriate out TProtocolFactory. This will be called once just after the GenericServlet.init() method
        Returns:
        the appropriate out TProtocolFactory
      • init

        public final void init​(javax.servlet.ServletConfig config)
                        throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class javax.servlet.GenericServlet
        Throws:
        javax.servlet.ServletException
      • doPost

        protected void doPost​(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              java.io.IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        See Also:
        HttpServlet.doPost(HttpServletRequest request, HttpServletResponse response)
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse resp)
                      throws javax.servlet.ServletException,
                             java.io.IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
        See Also:
        HttpServlet.doGet(HttpServletRequest request, HttpServletResponse response)
      • addCustomHeader

        public void addCustomHeader​(java.lang.String key,
                                    java.lang.String value)
      • setCustomHeaders

        public void setCustomHeaders​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> headers)