Class AxisServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.axis2.transport.http.AxisServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class AxisServlet extends jakarta.servlet.http.HttpServlet
Servlet implementing the HTTP and HTTPS transport. Note that this class doesn't implement TransportListener. There are two reasons for this:
  • There must be one instance of TransportListener for each protocol, but this servlet may implement both HTTP and HTTPS.
  • There is a collision between TransportListener.destroy() and Servlet.destroy().
The TransportListener implementation is provided by AxisServletListener. An instance of that class must be declared in axis2.xml for each protocol (HTTP/HTTPS) that the servlet should accept.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Ues in processing REST related Requests.
    protected class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected ListingAgent
     
    protected org.apache.axis2.engine.AxisConfiguration
     
    protected org.apache.axis2.context.ConfigurationContext
     
    static final String
     
    protected String
     
    protected boolean
     
    protected boolean
     
    protected jakarta.servlet.ServletConfig
     
    static final String
     

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.axis2.context.MessageContext
    createMessageContext(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
    This method assumes, that the created MessageContext will be used in only SOAP invocation.
    protected org.apache.axis2.context.MessageContext
    createMessageContext(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean invocationType)
     
    void
    distroy the ConfigurationContext
    protected void
    doDelete(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Implementation of DELETE interface
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Implementation for GET interface
    protected void
    doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Implementaion of POST interface
    protected void
    doPut(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Implementation of PUT interface
    protected Map<String,String>
    getTransportHeaders(jakarta.servlet.http.HttpServletRequest req)
    Get all transport headers.
    protected void
    handleFault(org.apache.axis2.context.MessageContext msgContext, OutputStream out, org.apache.axis2.AxisFault e)
     
    void
    Convenient method to re-initialize the ConfigurationContext
    void
    init(jakarta.servlet.ServletConfig config)
    Main init method
    protected org.apache.axis2.context.ConfigurationContext
    initConfigContext(jakarta.servlet.ServletConfig config)
    Initialize the Axis configuration context
    void
    initContextRoot(jakarta.servlet.http.HttpServletRequest req)
    Set the context root if it is not set already.
    protected void
    initGetRequestProcessors(jakarta.servlet.ServletConfig config)
    Initialize HTTP GET request processors
    protected void
    Initializes the Axis2 parameters.
    protected void
    Initialize HTTP transports
    protected void
    showJSONOnlyErrorMessage(jakarta.servlet.http.HttpServletResponse response)
    Private method that deals with disabling of SOAP and REST support.
    protected void
    showRestDisabledErrorMessage(jakarta.servlet.http.HttpServletResponse response)
    Private method that deals with disabling of REST support.

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doHead, doOptions, doPatch, doTrace, getLastModified, isSensitiveHeader, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

    getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CONFIGURATION_CONTEXT

      public static final String CONFIGURATION_CONTEXT
      See Also:
    • SESSION_ID

      public static final String SESSION_ID
      See Also:
    • configContext

      protected transient org.apache.axis2.context.ConfigurationContext configContext
    • axisConfiguration

      protected transient org.apache.axis2.engine.AxisConfiguration axisConfiguration
    • servletConfig

      protected transient jakarta.servlet.ServletConfig servletConfig
    • agent

      protected transient ListingAgent agent
    • contextRoot

      protected transient String contextRoot
    • disableREST

      protected boolean disableREST
    • enableJSONOnly

      protected boolean enableJSONOnly
  • Constructor Details

    • AxisServlet

      public AxisServlet()
  • Method Details

    • doPost

      protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Implementaion of POST interface
      Overrides:
      doPost in class jakarta.servlet.http.HttpServlet
      Parameters:
      request -
      response -
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Implementation for GET interface
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Parameters:
      request -
      response -
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doDelete

      protected void doDelete(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Implementation of DELETE interface
      Overrides:
      doDelete in class jakarta.servlet.http.HttpServlet
      Parameters:
      request -
      response -
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doPut

      protected void doPut(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Implementation of PUT interface
      Overrides:
      doPut in class jakarta.servlet.http.HttpServlet
      Parameters:
      request -
      response -
      Throws:
      jakarta.servlet.ServletException
      IOException
    • showRestDisabledErrorMessage

      protected void showRestDisabledErrorMessage(jakarta.servlet.http.HttpServletResponse response) throws IOException
      Private method that deals with disabling of REST support.
      Parameters:
      response -
      Throws:
      IOException
    • showJSONOnlyErrorMessage

      protected void showJSONOnlyErrorMessage(jakarta.servlet.http.HttpServletResponse response) throws IOException
      Private method that deals with disabling of SOAP and REST support.
      Parameters:
      response -
      Throws:
      IOException
    • handleFault

      protected void handleFault(org.apache.axis2.context.MessageContext msgContext, OutputStream out, org.apache.axis2.AxisFault e) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Main init method
      Specified by:
      init in interface jakarta.servlet.Servlet
      Overrides:
      init in class jakarta.servlet.http.HttpServlet
      Parameters:
      config - The ServletConfig
      Throws:
      jakarta.servlet.ServletException
    • initGetRequestProcessors

      protected void initGetRequestProcessors(jakarta.servlet.ServletConfig config)
      Initialize HTTP GET request processors
      Parameters:
      config - The ServletConfig of this Servlet
    • initTransports

      protected void initTransports() throws org.apache.axis2.AxisFault
      Initialize HTTP transports
      Throws:
      org.apache.axis2.AxisFault - If an error occurs while initializing transports
    • destroy

      public void destroy()
      distroy the ConfigurationContext
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet
    • initParams

      protected void initParams()
      Initializes the Axis2 parameters.
    • init

      public void init() throws jakarta.servlet.ServletException
      Convenient method to re-initialize the ConfigurationContext
      Overrides:
      init in class jakarta.servlet.GenericServlet
      Throws:
      jakarta.servlet.ServletException
    • initConfigContext

      protected org.apache.axis2.context.ConfigurationContext initConfigContext(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Initialize the Axis configuration context
      Parameters:
      config - Servlet configuration
      Returns:
      ConfigurationContext
      Throws:
      jakarta.servlet.ServletException
    • initContextRoot

      public void initContextRoot(jakarta.servlet.http.HttpServletRequest req)
      Set the context root if it is not set already.
      Parameters:
      req -
    • getTransportHeaders

      protected Map<String,String> getTransportHeaders(jakarta.servlet.http.HttpServletRequest req)
      Get all transport headers.
      Parameters:
      req -
      Returns:
      Map
    • createMessageContext

      protected org.apache.axis2.context.MessageContext createMessageContext(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean invocationType) throws IOException
      Parameters:
      request -
      response -
      invocationType - : If invocationType=true; then this will be used in SOAP message invocation. If invocationType=false; then this will be used in REST message invocation.
      Returns:
      MessageContext
      Throws:
      IOException
    • createMessageContext

      protected org.apache.axis2.context.MessageContext createMessageContext(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException
      This method assumes, that the created MessageContext will be used in only SOAP invocation.
      Parameters:
      req -
      resp -
      Returns:
      MessageContext
      Throws:
      IOException