org.ogf.graap.wsag.wsrf.bootstrap
Class Bootstrap

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.ogf.graap.wsag.wsrf.bootstrap.Bootstrap
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Bootstrap
extends javax.servlet.http.HttpServlet

This is essentially a copy of the Axis2 Servlet. It includes a patch in the initialization method to prevent the registration of a shutdown hook by the ListenerManager (init(ServletConfig)), which causes a memory leak when re-deploying in tomcat. When upgrading to a new version, this file MUST be upgraded too. (probably the shutdown hook can be prevented in future by configuration)

Author:
Oliver Waeldrich
See Also:
Serialized Form

Nested Class Summary
protected  class Bootstrap.RestRequestProcessor
          Ues in processing REST related Requests.
protected  class Bootstrap.ServletRequestResponseTransport
           
 
Field Summary
protected  org.apache.axis2.transport.http.ListingAgent agent
          The Listing Agent.
protected  org.apache.axis2.engine.AxisConfiguration axisConfiguration
          Axis Configuration
protected  org.apache.axis2.context.ConfigurationContext configContext
          Configuration Context
static String CONFIGURATION_CONTEXT
          Configuration Context
protected  String contextRoot
          Context Root.
protected  boolean disableREST
          disable REST
protected  javax.servlet.ServletConfig servletConfig
          Servlet Configuration
static String SESSION_ID
          Session ID
 
Constructor Summary
Bootstrap()
           
 
Method Summary
protected  org.apache.axis2.context.MessageContext createMessageContext(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  org.apache.axis2.context.MessageContext createMessageContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean invocationType)
           
 void destroy()
          distroy the ConfigurationContext
protected  void doDelete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Implementation of DELETE interface
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Implementation for GET interface
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Implementation of POST interface
protected  void doPut(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Implementation of PUT interface
protected  Map<?,?> getTransportHeaders(javax.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 init()
          Convenient method to re-initialize the ConfigurationContext
 void init(javax.servlet.ServletConfig config)
          Main init method
protected  org.apache.axis2.context.ConfigurationContext initConfigContext(javax.servlet.ServletConfig config)
          Initialize the Axis configuration context
 void initContextRoot(javax.servlet.http.HttpServletRequest req)
          Set the context root if it is not set already.
protected  void initParams()
          Initializes the Axis2 parameters.
protected  void showRestDisabledErrorMessage(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
 
Methods inherited from class javax.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 Detail

CONFIGURATION_CONTEXT

public static final String CONFIGURATION_CONTEXT
Configuration Context

See Also:
Constant Field Values

SESSION_ID

public static final String SESSION_ID
Session ID

See Also:
Constant Field Values

configContext

protected transient org.apache.axis2.context.ConfigurationContext configContext
Configuration Context


axisConfiguration

protected transient org.apache.axis2.engine.AxisConfiguration axisConfiguration
Axis Configuration


servletConfig

protected transient javax.servlet.ServletConfig servletConfig
Servlet Configuration


agent

protected transient org.apache.axis2.transport.http.ListingAgent agent
The Listing Agent.


contextRoot

protected transient String contextRoot
Context Root.


disableREST

protected boolean disableREST
disable REST

Constructor Detail

Bootstrap

public Bootstrap()
Method Detail

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      IOException
Implementation of POST interface

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException - an servlet error
IOException - an i/o error

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     IOException
Implementation for GET interface

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException - an servlet error
IOException - an i/o error

doDelete

protected void doDelete(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws javax.servlet.ServletException,
                        IOException
Implementation of DELETE interface

Overrides:
doDelete in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException - servlet error
IOException - I/O error

doPut

protected void doPut(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     IOException
Implementation of PUT interface

Overrides:
doPut in class javax.servlet.http.HttpServlet
Parameters:
request - the request
response - the response
Throws:
javax.servlet.ServletException - an servlet error
IOException - an i/o error

showRestDisabledErrorMessage

protected void showRestDisabledErrorMessage(javax.servlet.http.HttpServletResponse response)
                                     throws IOException
Private method that deals with disabling of REST support.

Parameters:
response - the response
Throws:
IOException - i/o exception

handleFault

protected void handleFault(org.apache.axis2.context.MessageContext msgContext,
                           OutputStream out,
                           org.apache.axis2.AxisFault e)
                    throws org.apache.axis2.AxisFault
Parameters:
msgContext - the message context
out - the response output stream
e - the fault
Throws:
org.apache.axis2.AxisFault - AXIS fault

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Main init method

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Parameters:
config - the servlet config
Throws:
javax.servlet.ServletException - servlet exception

destroy

public void destroy()
distroy the ConfigurationContext

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

initParams

protected void initParams()
Initializes the Axis2 parameters.


init

public void init()
          throws javax.servlet.ServletException
Convenient method to re-initialize the ConfigurationContext

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - the error

initConfigContext

protected org.apache.axis2.context.ConfigurationContext initConfigContext(javax.servlet.ServletConfig config)
                                                                   throws javax.servlet.ServletException
Initialize the Axis configuration context

Parameters:
config - Servlet configuration
Returns:
ConfigurationContext the configuration context
Throws:
javax.servlet.ServletException - a servlet exception

initContextRoot

public void initContextRoot(javax.servlet.http.HttpServletRequest req)
Set the context root if it is not set already.

Parameters:
req - the request

getTransportHeaders

protected Map<?,?> getTransportHeaders(javax.servlet.http.HttpServletRequest req)
Get all transport headers.

Parameters:
req - the request
Returns:
Map the transport headers

createMessageContext

protected org.apache.axis2.context.MessageContext createMessageContext(javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response,
                                                                       boolean invocationType)
                                                                throws IOException
Parameters:
request - the request
response - the 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 the message context
Throws:
IOException - IO error

createMessageContext

protected org.apache.axis2.context.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 - the request
resp - the response
Returns:
MessageContext the message context
Throws:
IOException - an IO error


Copyright © 2008-2012. All Rights Reserved.