Package org.apache.axis2.transport.http
Class AxisServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.apache.axis2.transport.http.AxisServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
AxisAdminServlet
public class AxisServlet extends javax.servlet.http.HttpServletServlet implementing the HTTP and HTTPS transport. Note that this class doesn't implementTransportListener. 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().
TransportListenerimplementation is provided byAxisServletListener. An instance of that class must be declared in axis2.xml for each protocol (HTTP/HTTPS) that the servlet should accept.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAxisServlet.RestRequestProcessorUes in processing REST related Requests.protected classAxisServlet.ServletRequestResponseTransport
-
Field Summary
Fields Modifier and Type Field Description protected ListingAgentagentprotected AxisConfigurationaxisConfigurationprotected ConfigurationContextconfigContextstatic StringCONFIGURATION_CONTEXTprotected StringcontextRootprotected booleandisableRESTprotected javax.servlet.ServletConfigservletConfigstatic StringSESSION_ID
-
Constructor Summary
Constructors Constructor Description AxisServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MessageContextcreateMessageContext(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)This method assumes, that the created MessageContext will be used in only SOAP invocation.protected MessageContextcreateMessageContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean invocationType)voiddestroy()distroy the ConfigurationContextprotected voiddoDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Implementation of DELETE interfaceprotected voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Implementation for GET interfaceprotected voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Implementaion of POST interfaceprotected voiddoPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Implementation of PUT interfaceprotected Map<String,String>getTransportHeaders(javax.servlet.http.HttpServletRequest req)Get all transport headers.protected voidhandleFault(MessageContext msgContext, OutputStream out, AxisFault e)voidinit()Convenient method to re-initialize the ConfigurationContextvoidinit(javax.servlet.ServletConfig config)Main init methodprotected ConfigurationContextinitConfigContext(javax.servlet.ServletConfig config)Initialize the Axis configuration contextvoidinitContextRoot(javax.servlet.http.HttpServletRequest req)Set the context root if it is not set already.protected voidinitGetRequestProcessors(javax.servlet.ServletConfig config)Initialize HTTP GET request processorsprotected voidinitParams()Initializes the Axis2 parameters.protected voidinitTransports()Initialize HTTP transportsprotected voidshowRestDisabledErrorMessage(javax.servlet.http.HttpServletResponse response)Private method that deals with disabling of REST support.-
Methods inherited from class javax.servlet.http.HttpServlet
doHead, doOptions, doTrace, getLastModified, service, service
-
-
-
-
Field Detail
-
CONFIGURATION_CONTEXT
public static final String CONFIGURATION_CONTEXT
- See Also:
- Constant Field Values
-
SESSION_ID
public static final String SESSION_ID
- See Also:
- Constant Field Values
-
configContext
protected transient ConfigurationContext configContext
-
axisConfiguration
protected transient AxisConfiguration axisConfiguration
-
servletConfig
protected transient javax.servlet.ServletConfig servletConfig
-
agent
protected transient ListingAgent agent
-
contextRoot
protected transient String contextRoot
-
disableREST
protected boolean disableREST
-
-
Method Detail
-
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOExceptionImplementaion of POST interface- Overrides:
doPostin classjavax.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
javax.servlet.ServletExceptionIOException
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOExceptionImplementation for GET interface- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
javax.servlet.ServletExceptionIOException
-
doDelete
protected void doDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOExceptionImplementation of DELETE interface- Overrides:
doDeletein classjavax.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
javax.servlet.ServletExceptionIOException
-
doPut
protected void doPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOExceptionImplementation of PUT interface- Overrides:
doPutin classjavax.servlet.http.HttpServlet- Parameters:
request-response-- Throws:
javax.servlet.ServletExceptionIOException
-
showRestDisabledErrorMessage
protected void showRestDisabledErrorMessage(javax.servlet.http.HttpServletResponse response) throws IOExceptionPrivate method that deals with disabling of REST support.- Parameters:
response-- Throws:
IOException
-
handleFault
protected void handleFault(MessageContext msgContext, OutputStream out, AxisFault e) throws AxisFault
- Throws:
AxisFault
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletExceptionMain init method- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Parameters:
config- The ServletConfig- Throws:
javax.servlet.ServletException
-
initGetRequestProcessors
protected void initGetRequestProcessors(javax.servlet.ServletConfig config)
Initialize HTTP GET request processors- Parameters:
config- The ServletConfig of this Servlet
-
initTransports
protected void initTransports() throws AxisFaultInitialize HTTP transports- Throws:
AxisFault- If an error occurs while initializing transports
-
destroy
public void destroy()
distroy the ConfigurationContext- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classjavax.servlet.GenericServlet
-
initParams
protected void initParams()
Initializes the Axis2 parameters.
-
init
public void init() throws javax.servlet.ServletExceptionConvenient method to re-initialize the ConfigurationContext- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
initConfigContext
protected ConfigurationContext initConfigContext(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
Initialize the Axis configuration context- Parameters:
config- Servlet configuration- Returns:
- ConfigurationContext
- Throws:
javax.servlet.ServletException
-
initContextRoot
public void initContextRoot(javax.servlet.http.HttpServletRequest req)
Set the context root if it is not set already.- Parameters:
req-
-
getTransportHeaders
protected Map<String,String> getTransportHeaders(javax.servlet.http.HttpServletRequest req)
Get all transport headers.- Parameters:
req-- Returns:
- Map
-
createMessageContext
protected MessageContext createMessageContext(javax.servlet.http.HttpServletRequest request, javax.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 MessageContext createMessageContext(javax.servlet.http.HttpServletRequest req, javax.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
-
-