org.apache.axis.transport.http

Class AxisServletBase

public class AxisServletBase extends HttpServlet

Base class for servlets used in axis, has common methods to get and save the engine to a common location, currently the webapp's context, though some alternate persistence mechanism is always possible. Also has a load counter shared by all servlets; tracks the # of active http requests open to any of the subclasses.

Author: Steve Loughran

Field Summary
protected static StringATTR_AXIS_ENGINE
name of the axis engine to use in the servlet context
protected AxisServeraxisServer
per-instance cache of the axis server
Method Summary
protected static voiddecLockCounter()
thread safe lock counter decrement
voiddestroy()
Destroy method is called when the servlet is going away.
AxisServergetEngine()
get the engine for this servlet from cache or context
static AxisServergetEngine(HttpServlet servlet)
This is a uniform method of initializing AxisServer in a servlet context.
protected static MapgetEngineEnvironment(HttpServlet servlet)
extract information from the servlet configuration files
protected StringgetHomeDir()
what is the root dir of the applet?
static intgetLoadCounter()
get a count of the # of services running.
protected StringgetOption(ServletContext context, String param, String dephault)
Retrieve option, in order of precedence: (Managed) System property (see discovery.ManagedProperty), servlet init param, context init param.
ServletContextgetServletContext()
what is the servlet context
protected StringgetWebappBase(HttpServletRequest request)
extract the base of our webapp from an inbound request
protected StringgetWebInfPath()
accessor to webinf
protected static voidincLockCounter()
thread safe lock counter increment
voidinit()
our initialize routine; subclasses should call this if they override it
booleanisDevelopment()
probe for the system being 'production'
protected voidservice(HttpServletRequest req, HttpServletResponse resp)
subclass of service method that tracks entry count; calls the parent's implementation to have the http method cracked and delegated to the doGet, doPost method.

Field Detail

ATTR_AXIS_ENGINE

protected static final String ATTR_AXIS_ENGINE
name of the axis engine to use in the servlet context

axisServer

protected AxisServer axisServer
per-instance cache of the axis server

Method Detail

decLockCounter

protected static void decLockCounter()
thread safe lock counter decrement

destroy

public void destroy()
Destroy method is called when the servlet is going away. Pass this down to the AxisEngine to let it clean up... But don't create the engine if it hasn't already been created.

UNKNOWN: Fixme for multiple servlets. This has always been slightly broken (the context's copy stayed around), but now we have extracted it into a superclass it is blatantly broken.

getEngine

public AxisServer getEngine()
get the engine for this servlet from cache or context

Returns:

Throws: AxisFault

getEngine

public static AxisServer getEngine(HttpServlet servlet)
This is a uniform method of initializing AxisServer in a servlet context.

UNKNOWN: add catch for not being able to cast the context attr to an engine and reinit the engine if so.

getEngineEnvironment

protected static Map getEngineEnvironment(HttpServlet servlet)
extract information from the servlet configuration files

Parameters: servlet

Returns:

getHomeDir

protected String getHomeDir()
what is the root dir of the applet?

Returns: path of root dir

getLoadCounter

public static int getLoadCounter()
get a count of the # of services running. This is only ever an approximate number in a busy system

Returns: The TotalServiceCount value

getOption

protected String getOption(ServletContext context, String param, String dephault)
Retrieve option, in order of precedence: (Managed) System property (see discovery.ManagedProperty), servlet init param, context init param. Use of system properties is discouraged in production environments, as it overrides everything else.

getServletContext

public ServletContext getServletContext()
what is the servlet context

Returns: get the context from the servlet config

getWebappBase

protected String getWebappBase(HttpServletRequest request)
extract the base of our webapp from an inbound request

Parameters: request request containing http://foobar/axis/services/something

Returns: some URL like http://foobar:8080/axis/

getWebInfPath

protected String getWebInfPath()
accessor to webinf

Returns: path to WEB-INF/ in the local filesystem

incLockCounter

protected static void incLockCounter()
thread safe lock counter increment

init

public void init()
our initialize routine; subclasses should call this if they override it

isDevelopment

public boolean isDevelopment()
probe for the system being 'production'

Returns: true for a dev system.

service

protected void service(HttpServletRequest req, HttpServletResponse resp)
subclass of service method that tracks entry count; calls the parent's implementation to have the http method cracked and delegated to the doGet, doPost method.

Parameters: req request resp response

Throws: ServletException something went wrong IOException something different went wrong

Copyright B) 2005 Apache Web Services Project. All Rights Reserved.