All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.jigsaw.servlet.ServletWrapper

java.lang.Object
   |
   +----org.w3c.tools.resources.AttributeHolder
           |
           +----org.w3c.tools.resources.Resource
                   |
                   +----org.w3c.tools.resources.FramedResource
                           |
                           +----org.w3c.jigsaw.servlet.ServletWrapper

public class ServletWrapper
extends FramedResource
implements ServletConfig

Variable Index

 o ATTR_PARAMETERS
Attribute index - The init parameters for that servlet.
 o ATTR_SERVLET_CLASS
Attributes index - The servlet class name.
 o ATTR_SERVLET_CONTEXT
Attribute index - Our parent-inherited servlet context.
 o ATTR_SESSION_CONTEXT
Attribute index - Our parent-inherited session context.
 o debug
 o inited
Is out servler initialized ?
 o servlet
The servlet wrapped within that Jigsaw resource.

Constructor Index

 o ServletWrapper()

Method Index

 o checkServlet()
Check the servlet class, ans try to initialize it.
 o createNewLocalServletLoader(boolean)
 o destroyServlet()
Destroy the servlet we are wrapping.
 o getInitParameter(String)
Servlet stub implementation - Get an init parameter value.
 o getInitParameterNames()
Servlet stub implementation - Get all init parameters.
 o getLocalServletLoader()
Get or create a suitable LocalServletLoader instance to load that servlet.
 o getServlet()
Get the servlet we are wrapping.
 o getServletClass()
Get the class name of the wrapped servlet.
 o getServletContext()
Servlet stub implementation - Get that servlet context.
 o getServletDirectory()
The Path where we can find the servlet class file.
 o getServletParameters()
Get the init parameters for our wrapped servlet.
 o getSessionContext()
 o initialize(Object[])
Initialize this servlet wrapper resource.
 o invalidateAllSession()
 o isInited()
 o isWrappingAServlet()
Check if the Servletclass wrapped is a Servlet class without initializing it.
 o launchServlet()
Launch the servlet we are wrapping.
 o launchServlet(Class)
Initialize our servlet from the given (loaded) class.
 o notifyUnload()
This resource is being unloaded.
 o service(Request, Reply)
 o setValue(int, Object)
Catch assignements to the servlet class name attribute.
 o setValueOfSuperClass(int, Object)

Variables

 o debug
 protected static final boolean debug
 o ATTR_SERVLET_CLASS
 protected static int ATTR_SERVLET_CLASS
Attributes index - The servlet class name.

 o ATTR_PARAMETERS
 protected static int ATTR_PARAMETERS
Attribute index - The init parameters for that servlet.

 o ATTR_SERVLET_CONTEXT
 protected static int ATTR_SERVLET_CONTEXT
Attribute index - Our parent-inherited servlet context.

 o ATTR_SESSION_CONTEXT
 protected static int ATTR_SESSION_CONTEXT
Attribute index - Our parent-inherited session context.

 o servlet
 protected Servlet servlet
The servlet wrapped within that Jigsaw resource.

 o inited
 protected boolean inited
Is out servler initialized ?

Constructors

 o ServletWrapper
 public ServletWrapper()

Methods

 o getServletDirectory
 public File getServletDirectory()
The Path where we can find the servlet class file.

 o getInitParameter
 public synchronized String getInitParameter(String string)
Servlet stub implementation - Get an init parameter value.

 o getInitParameterNames
 public synchronized Enumeration getInitParameterNames()
Servlet stub implementation - Get all init parameters.

 o getServletContext
 public ServletContext getServletContext()
Servlet stub implementation - Get that servlet context.

 o getSessionContext
 public JigsawHttpSessionContext getSessionContext()
 o invalidateAllSession
 protected void invalidateAllSession()
 o checkServlet
 protected void checkServlet() throws ClassNotFoundException, ServletException
Check the servlet class, ans try to initialize it.

Throws: ClassNotFoundException
if servlet class can't be found.
Throws: ServletException
if servlet can't be initialized.
 o isInited
 protected boolean isInited()
 o service
 protected void service(Request request,
                        Reply reply) throws ServletException, IOException
 o getServletClass
 public String getServletClass()
Get the class name of the wrapped servlet.

Returns:
The class name for the servlet if attribute is defined. Otherwise the class name is deduced from the resource identifier.
 o getServletParameters
 public ArrayDictionary getServletParameters()
Get the init parameters for our wrapped servlet.

Returns:
An ArrayDictionary instance if the attribute is defined, false otherwise.
 o setValueOfSuperClass
 protected void setValueOfSuperClass(int idx,
                                     Object value)
 o setValue
 public void setValue(int idx,
                      Object value)
Catch assignements to the servlet class name attribute.

When a change to that attribute is detected, the servlet is automatically reinitialized.

Overrides:
setValue in class FramedResource
 o destroyServlet
 protected synchronized void destroyServlet()
Destroy the servlet we are wrapping.

 o getServlet
 public synchronized Servlet getServlet()
Get the servlet we are wrapping.

Returns:
A servlet instance, if the servlet is alredy running, null otherwise.
 o launchServlet
 protected boolean launchServlet(Class cls) throws ServletException
Initialize our servlet from the given (loaded) class.

Parameters:
cls - The servlet loaded main class.
Returns:
A boolean, true if servlet was successfully initialised, false otherwise.
Throws: ServletException
if servlet can't be initialized.
 o isWrappingAServlet
 protected boolean isWrappingAServlet()
Check if the Servletclass wrapped is a Servlet class without initializing it. (not the same than checkServlet). used by the ServletIndexer.

Returns:
A boolean.
See Also:
ServletIndexer
 o launchServlet
 protected boolean launchServlet() throws ClassNotFoundException, ServletException
Launch the servlet we are wrapping.

This method either succeed, or the wrapper resource itself will fail to initialize, acting as transparently as possible (in some sense).

Returns:
A boolean, true if servlet launched.
Throws: ClassNotFoundException
if servlet class can't be found.
Throws: ServletException
if servlet can't be initialized.
 o notifyUnload
 public void notifyUnload()
This resource is being unloaded.

Overrides:
notifyUnload in class FramedResource
 o getLocalServletLoader
 protected synchronized AutoReloadServletLoader getLocalServletLoader()
Get or create a suitable LocalServletLoader instance to load that servlet.

Returns:
A LocalServletLoader instance.
 o createNewLocalServletLoader
 protected AutoReloadServletLoader createNewLocalServletLoader(boolean keepold)
 o initialize
 public void initialize(Object values[])
Initialize this servlet wrapper resource. After the wrapper itself is inited, it performs the servlet initialzation.

Parameters:
values - The default attribute values.
Overrides:
initialize in class FramedResource

All Packages  Class Hierarchy  This Package  Previous  Next  Index