Package org.apache.axis2.transport.http
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
TransportListenerfor each protocol, but this servlet may implement both HTTP and HTTPS. - There is a collision between
TransportListener.destroy()andServlet.destroy().
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 ClassesModifier and TypeClassDescriptionprotected classUes in processing REST related Requests.protected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ListingAgentprotected org.apache.axis2.engine.AxisConfigurationprotected org.apache.axis2.context.ConfigurationContextstatic final Stringprotected Stringprotected booleanprotected booleanprotected jakarta.servlet.ServletConfigstatic final StringFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.axis2.context.MessageContextcreateMessageContext(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.MessageContextcreateMessageContext(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, boolean invocationType) voiddestroy()distroy the ConfigurationContextprotected voiddoDelete(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Implementation of DELETE interfaceprotected voiddoGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Implementation for GET interfaceprotected voiddoPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Implementaion of POST interfaceprotected voiddoPut(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Implementation of PUT interfacegetTransportHeaders(jakarta.servlet.http.HttpServletRequest req) Get all transport headers.protected voidhandleFault(org.apache.axis2.context.MessageContext msgContext, OutputStream out, org.apache.axis2.AxisFault e) voidinit()Convenient method to re-initialize the ConfigurationContextvoidinit(jakarta.servlet.ServletConfig config) Main init methodprotected org.apache.axis2.context.ConfigurationContextinitConfigContext(jakarta.servlet.ServletConfig config) Initialize the Axis configuration contextvoidinitContextRoot(jakarta.servlet.http.HttpServletRequest req) Set the context root if it is not set already.protected voidinitGetRequestProcessors(jakarta.servlet.ServletConfig config) Initialize HTTP GET request processorsprotected voidInitializes the Axis2 parameters.protected voidInitialize HTTP transportsprotected voidshowJSONOnlyErrorMessage(jakarta.servlet.http.HttpServletResponse response) Private method that deals with disabling of SOAP and REST support.protected voidshowRestDisabledErrorMessage(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, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
-
Field Details
-
CONFIGURATION_CONTEXT
- See Also:
-
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
-
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:
doPostin classjakarta.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
jakarta.servlet.ServletExceptionIOException
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException Implementation for GET interface- Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
jakarta.servlet.ServletExceptionIOException
-
doDelete
protected void doDelete(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException Implementation of DELETE interface- Overrides:
doDeletein classjakarta.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
jakarta.servlet.ServletExceptionIOException
-
doPut
protected void doPut(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException Implementation of PUT interface- Overrides:
doPutin classjakarta.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
jakarta.servlet.ServletExceptionIOException
-
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:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.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.AxisFaultInitialize HTTP transports- Throws:
org.apache.axis2.AxisFault- If an error occurs while initializing transports
-
destroy
public void destroy()distroy the ConfigurationContext- Specified by:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classjakarta.servlet.GenericServlet
-
initParams
protected void initParams()Initializes the Axis2 parameters. -
init
public void init() throws jakarta.servlet.ServletExceptionConvenient method to re-initialize the ConfigurationContext- Overrides:
initin classjakarta.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
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
-