Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.transport.http
Class AxisServlet  view AxisServlet download AxisServlet.java

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.apache.axis.transport.http.AxisServletBase
              extended byorg.apache.axis.transport.http.AxisServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class AxisServlet
extends AxisServletBase


Field Summary
private  boolean disableServicesList
          Should we turn off the list of services when we receive a GET at the servlet root?
private  boolean enableList
          Should we enable the "?list" functionality on GETs? (off by default because deployment information is a potential security hole)
private static org.apache.commons.logging.Log exceptionLog
          a separate log for exceptions lets users route them differently from general low level debug info
static java.lang.String INIT_PROPERTY_DISABLE_SERVICES_LIST
           
static java.lang.String INIT_PROPERTY_ENABLE_LIST
           
static java.lang.String INIT_PROPERTY_JWS_CLASS_DIR
           
static java.lang.String INIT_PROPERTY_SERVICES_PATH
           
static java.lang.String INIT_PROPERTY_TRANSPORT_NAME
           
static java.lang.String INIT_PROPERTY_USE_SECURITY
           
private static boolean isDebug
          cache of logging debug option; only evaluated at init time.
private  java.lang.String jwsClassDir
          Cached path to JWS output directory
protected static org.apache.commons.logging.Log log
           
private  org.apache.axis.security.servlet.ServletSecurityProvider securityProvider
           
private  java.lang.String servicesPath
           
private static org.apache.commons.logging.Log tlog
          this log is for timing
private  org.apache.axis.Handler transport
           
private  java.lang.String transportName
           
 
Fields inherited from class org.apache.axis.transport.http.AxisServletBase
ATTR_AXIS_ENGINE, axisServer
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
AxisServlet()
          create a new servlet instance
 
Method Summary
private  void configureResponseFromAxisFault(javax.servlet.http.HttpServletResponse response, org.apache.axis.AxisFault fault)
          Configure the servlet response status code and maybe other headers from the fault info.
private  org.apache.axis.Message convertExceptionToAxisFault(java.lang.Exception exception, org.apache.axis.Message responseMsg)
          turn any Exception into an AxisFault, log it, set the response status code according to what the specifications say and return a response message for posting.
private  org.apache.axis.MessageContext createMessageContext(org.apache.axis.AxisEngine engine, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Place the Request message in the MessagContext object - notice that we just leave it as a 'ServletRequest' object and let the Message processing routine convert it - we don't do it since we don't know how it's going to be used - perhaps it might not even need to be parsed.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process GET requests.
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Process a POST to the servlet by handing it off to the Axis Engine.
protected  java.lang.String getDefaultJWSClassDir()
          Provided to allow overload of default JWSClassDir by derived class.
protected  int getHttpServletResponseStatus(org.apache.axis.AxisFault af)
          Extract information from AxisFault and map it to a HTTP Status code.
protected  java.lang.String getJWSClassDir()
           
private static java.lang.String getRequestPath(javax.servlet.http.HttpServletRequest request)
          getRequestPath a returns request path for web service padded with request.getPathInfo for web services served from /services directory.
private  java.lang.String getSoapAction(javax.servlet.http.HttpServletRequest req)
          Extract the SOAPAction header.
 void init()
          Initialization method.
 void initQueryStringHandlers()
          Initialize a Handler for the transport defined in the Axis server config.
protected  void logException(java.lang.Throwable e)
          log any exception to our output log, at our chosen level
protected  void processAxisFault(org.apache.axis.AxisFault fault)
          routine called whenever an axis fault is caught; where they are logged and any other business.
private  boolean processQuery(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.PrintWriter writer)
          Attempts to invoke a plugin for the query string supplied in the URL.
protected  void reportAvailableServices(javax.servlet.http.HttpServletResponse response, java.io.PrintWriter writer, javax.servlet.http.HttpServletRequest request)
          This method lists the available services; it is called when there is nothing to execute on a GET
protected  void reportCantGetAxisService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.PrintWriter writer)
          generate the error response to indicate that there is apparently no endpoint there
protected  void reportCantGetJWSService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.PrintWriter writer)
          probe for a JWS page and report 'no service' if one is not found there
protected  void reportNoWSDL(javax.servlet.http.HttpServletResponse res, java.io.PrintWriter writer, java.lang.String moreDetailCode, org.apache.axis.AxisFault axisFault)
          report that we have no WSDL This method was moved to the querystring handler QSWSDLHandler.
protected  void reportServiceInfo(javax.servlet.http.HttpServletResponse response, java.io.PrintWriter writer, org.apache.axis.handlers.soap.SOAPService service, java.lang.String serviceName)
          print a snippet of service info.
private  void reportTroubleInGet(java.lang.Throwable exception, javax.servlet.http.HttpServletResponse response, java.io.PrintWriter writer)
          when we get an exception or an axis fault in a GET, we handle it almost identically: we go 'something went wrong', set the response code to 500 and then dump info.
private  void sendResponse(java.lang.String contentType, javax.servlet.http.HttpServletResponse res, org.apache.axis.Message responseMsg)
          write a message to the response, set appropriate headers for content type..etc.
private  void writeFault(java.io.PrintWriter writer, org.apache.axis.AxisFault axisFault)
          this method writes a fault out to an HTML stream.
 
Methods inherited from class org.apache.axis.transport.http.AxisServletBase
decLockCounter, destroy, getEngine, getEngine, getEngineEnvironment, getHomeDir, getLoadCounter, getOption, getServletContext, getWebappBase, getWebInfPath, incLockCounter, isDevelopment, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

tlog

private static org.apache.commons.logging.Log tlog
this log is for timing


exceptionLog

private static org.apache.commons.logging.Log exceptionLog
a separate log for exceptions lets users route them differently from general low level debug info


INIT_PROPERTY_TRANSPORT_NAME

public static final java.lang.String INIT_PROPERTY_TRANSPORT_NAME
See Also:
Constant Field Values

INIT_PROPERTY_USE_SECURITY

public static final java.lang.String INIT_PROPERTY_USE_SECURITY
See Also:
Constant Field Values

INIT_PROPERTY_ENABLE_LIST

public static final java.lang.String INIT_PROPERTY_ENABLE_LIST
See Also:
Constant Field Values

INIT_PROPERTY_JWS_CLASS_DIR

public static final java.lang.String INIT_PROPERTY_JWS_CLASS_DIR
See Also:
Constant Field Values

INIT_PROPERTY_DISABLE_SERVICES_LIST

public static final java.lang.String INIT_PROPERTY_DISABLE_SERVICES_LIST
See Also:
Constant Field Values

INIT_PROPERTY_SERVICES_PATH

public static final java.lang.String INIT_PROPERTY_SERVICES_PATH
See Also:
Constant Field Values

transportName

private java.lang.String transportName

transport

private org.apache.axis.Handler transport

securityProvider

private org.apache.axis.security.servlet.ServletSecurityProvider securityProvider

servicesPath

private java.lang.String servicesPath

isDebug

private static boolean isDebug
cache of logging debug option; only evaluated at init time. So no dynamic switching of logging options with this servlet.


enableList

private boolean enableList
Should we enable the "?list" functionality on GETs? (off by default because deployment information is a potential security hole)


disableServicesList

private boolean disableServicesList
Should we turn off the list of services when we receive a GET at the servlet root?


jwsClassDir

private java.lang.String jwsClassDir
Cached path to JWS output directory

Constructor Detail

AxisServlet

public AxisServlet()
create a new servlet instance

Method Detail

getJWSClassDir

protected java.lang.String getJWSClassDir()

init

public void init()
          throws javax.servlet.ServletException
Initialization method.

Overrides:
init in class AxisServletBase

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Process GET requests. This includes handoff of pseudo-SOAP requests


reportTroubleInGet

private void reportTroubleInGet(java.lang.Throwable exception,
                                javax.servlet.http.HttpServletResponse response,
                                java.io.PrintWriter writer)
when we get an exception or an axis fault in a GET, we handle it almost identically: we go 'something went wrong', set the response code to 500 and then dump info. But we dump different info for an axis fault or subclass thereof.


processAxisFault

protected void processAxisFault(org.apache.axis.AxisFault fault)
routine called whenever an axis fault is caught; where they are logged and any other business. The method may modify the fault in the process


logException

protected void logException(java.lang.Throwable e)
log any exception to our output log, at our chosen level


writeFault

private void writeFault(java.io.PrintWriter writer,
                        org.apache.axis.AxisFault axisFault)
this method writes a fault out to an HTML stream. This includes escaping the strings to defend against cross-site scripting attacks


reportServiceInfo

protected void reportServiceInfo(javax.servlet.http.HttpServletResponse response,
                                 java.io.PrintWriter writer,
                                 org.apache.axis.handlers.soap.SOAPService service,
                                 java.lang.String serviceName)
print a snippet of service info.


reportNoWSDL

protected void reportNoWSDL(javax.servlet.http.HttpServletResponse res,
                            java.io.PrintWriter writer,
                            java.lang.String moreDetailCode,
                            org.apache.axis.AxisFault axisFault)
report that we have no WSDL This method was moved to the querystring handler QSWSDLHandler. The method reportNoWSDL in AxisServlet is never called. Perhaps the method is overwritten in subclasses of AxisServlet so the method wasn't removed. See the discussion in http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23845


reportAvailableServices

protected void reportAvailableServices(javax.servlet.http.HttpServletResponse response,
                                       java.io.PrintWriter writer,
                                       javax.servlet.http.HttpServletRequest request)
                                throws org.apache.axis.ConfigurationException,
                                       org.apache.axis.AxisFault
This method lists the available services; it is called when there is nothing to execute on a GET


reportCantGetAxisService

protected void reportCantGetAxisService(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        java.io.PrintWriter writer)
generate the error response to indicate that there is apparently no endpoint there


reportCantGetJWSService

protected void reportCantGetJWSService(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response,
                                       java.io.PrintWriter writer)
probe for a JWS page and report 'no service' if one is not found there


doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws javax.servlet.ServletException,
                   java.io.IOException
Process a POST to the servlet by handing it off to the Axis Engine. Here is where SOAP messages are received


configureResponseFromAxisFault

private void configureResponseFromAxisFault(javax.servlet.http.HttpServletResponse response,
                                            org.apache.axis.AxisFault fault)
Configure the servlet response status code and maybe other headers from the fault info.


convertExceptionToAxisFault

private org.apache.axis.Message convertExceptionToAxisFault(java.lang.Exception exception,
                                                            org.apache.axis.Message responseMsg)
turn any Exception into an AxisFault, log it, set the response status code according to what the specifications say and return a response message for posting. This will be the response message passed in if non-null; one generated from the fault otherwise.


getHttpServletResponseStatus

protected int getHttpServletResponseStatus(org.apache.axis.AxisFault af)
Extract information from AxisFault and map it to a HTTP Status code.


sendResponse

private void sendResponse(java.lang.String contentType,
                          javax.servlet.http.HttpServletResponse res,
                          org.apache.axis.Message responseMsg)
                   throws org.apache.axis.AxisFault,
                          java.io.IOException
write a message to the response, set appropriate headers for content type..etc.


createMessageContext

private org.apache.axis.MessageContext createMessageContext(org.apache.axis.AxisEngine engine,
                                                            javax.servlet.http.HttpServletRequest req,
                                                            javax.servlet.http.HttpServletResponse res)
Place the Request message in the MessagContext object - notice that we just leave it as a 'ServletRequest' object and let the Message processing routine convert it - we don't do it since we don't know how it's going to be used - perhaps it might not even need to be parsed.


getSoapAction

private java.lang.String getSoapAction(javax.servlet.http.HttpServletRequest req)
                                throws org.apache.axis.AxisFault
Extract the SOAPAction header. if SOAPAction is null then we'll we be forced to scan the body for it. if SOAPAction is "" then use the URL


getDefaultJWSClassDir

protected java.lang.String getDefaultJWSClassDir()
Provided to allow overload of default JWSClassDir by derived class.


initQueryStringHandlers

public void initQueryStringHandlers()
Initialize a Handler for the transport defined in the Axis server config. This includes optionally filling in query string handlers.


processQuery

private boolean processQuery(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             java.io.PrintWriter writer)
                      throws org.apache.axis.AxisFault
Attempts to invoke a plugin for the query string supplied in the URL.


getRequestPath

private static java.lang.String getRequestPath(javax.servlet.http.HttpServletRequest request)
getRequestPath a returns request path for web service padded with request.getPathInfo for web services served from /services directory. This is a required to support serving .jws web services from /services URL. See AXIS-843 for more information.