public class ChainServlet
extends javax.servlet.http.HttpServlet
Servlet
that automatically scans chain configuration files
in the current web application at startup time, and exposes the result in a
Catalog
under a specified servlet context attribute. The following
servlet init parameters are utilized:
ClassLoader.getResource()
calls. If not specified,
no class loader resources will be loaded.Catalog
will be created or updated.
If not specified, it is expected that parsed resources will
contain <catalog>
elements (which will
cause registration of the created Catalog
s into
the CatalogFactory
for this application, and no
servet context attribute will be created.
NOTE - This parameter is deprecated.
RuleSet
implementation to use for parsing configuration resources (this
class must have a public zero-args constructor). If not defined,
the standard RuleSet
implementation will be used.When a web application that has configured this servlet is
started, it will acquire the Catalog
under the specified servlet
context attribute key, creating a new one if there is none already there.
This Catalog
will then be populated by scanning configuration
resources from the following sources (loaded in this order):
ClassLoader.getResource()
).ServetContext.getResource()
).If no attribute key is specified, on the other hand, parsed configuration
resources are expected to contain <catalog>
elements,
and the catalogs will be registered with the CatalogFactory
for this web application.
This class runs on Servlet 2.2 or later. If you are running on a
Servlet 2.3 or later system, you should also consider using
ChainListener
to initialize your Catalog
. Note that
ChainListener
uses parameters of the same names, but they are
context init parameters instead of servlet init
parameters. Because of this, you can use both facilities in the
same application, if desired.
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_ATTR
The name of the context init parameter containing the name of the
servlet context attribute under which our resulting
Catalog
will be stored. |
static String |
CONFIG_CLASS_RESOURCE
The name of the context init parameter containing a comma-delimited
list of class loader resources to be scanned.
|
static String |
CONFIG_WEB_RESOURCE
The name of the context init parameter containing a comma-delimited
list of web applicaton resources to be scanned.
|
static String |
RULE_SET
The name of the context init parameter containing the fully
qualified class name of the
RuleSet implementation
for configuring our ConfigParser . |
Constructor and Description |
---|
ChainServlet() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Clean up after ourselves as this application shuts down.
|
void |
init()
Create (if necessary) and configure a
Catalog from the
servlet init parameters that have been specified. |
void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Does nothing; this servlet's only purpose is to initialize a Chain
and store it in the servlet context.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final String CONFIG_ATTR
The name of the context init parameter containing the name of the
servlet context attribute under which our resulting Catalog
will be stored.
public static final String CONFIG_CLASS_RESOURCE
The name of the context init parameter containing a comma-delimited list of class loader resources to be scanned.
public static final String CONFIG_WEB_RESOURCE
The name of the context init parameter containing a comma-delimited list of web applicaton resources to be scanned.
public static final String RULE_SET
The name of the context init parameter containing the fully
qualified class name of the RuleSet
implementation
for configuring our ConfigParser
.
public void destroy()
Clean up after ourselves as this application shuts down.
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
public void init() throws javax.servlet.ServletException
Create (if necessary) and configure a Catalog
from the
servlet init parameters that have been specified.
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
- if the servlet could not be initializedpublic void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
Does nothing; this servlet's only purpose is to initialize a Chain and store it in the servlet context.
service
in class javax.servlet.http.HttpServlet
request
- the request issued by the clientresponse
- the response to be returned to the cliengtjavax.servlet.ServletException
- (this exception is never thrown)IOException
- (this exception is never thrown)Copyright © 2003–2021 The Apache Software Foundation. All rights reserved.