|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--com.arsdigita.acs.RequestProcessor
Request procesor servlet for ACS -- handles abstract URLs and filters.
When this servlet is mapped to "/" in the acs-java context, it will handle all requests in the context that do not have a specific servlet associated with them. In other words, it can receive and handle requests for paths corresponding to non-existent files.
Its service() method looks at the requested URI, and if the file doesn't exist, it tries adding different extensions (.jsp, .html, etc.); on success, it forwards to the appropriate servlet. On failure (no matching file), it forwards to the default servlet to display the 404 message.
Also handles registration of filters.
NOTE: you MUST override the default mapping of *.jsp URLs in the ACS servlet context for JSP requests to be filtered. Otherwise, explicitly requesting a *.jsp URL will go directly to the JspServlet and not through the this servlet. In the context's web.xml file you should have a servlet mapping from the URL pattern "*.jsp" to RequestProcessor.
Assumes that there are servlets in the same servlet context named "jsp" (to handle JSPs) and "default" to handle everything else (true in Tomcat, Sun JWS, not sure about Oracle 8.1.7, but should be similar if their web server is based on Tomcat)
Note: if the request URL is a directory, then we look for dir/index.* instead of dir.*.
Constructor Summary | |
RequestProcessor()
|
Method Summary | |
(package private) static void |
|
static RequestProcessor |
getInstance()
Returns the currently-loaded instance of the request processor servlet. |
void |
init()
Called when servlet is loaded, and sets static instance. |
static void |
registerFilter(String path,
Filter f)
Registers a request filter with no particular priority. |
static void |
registerFilter(String path,
Filter f,
int priority)
Registers a request filter with a priority. |
void |
service(HttpServletRequest req,
HttpServletResponse resp)
Handles an abstract URL in the request req, and executes filters on the request. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RequestProcessor()
Method Detail |
static void()
public static RequestProcessor getInstance()
public void init() throws ServletException
init
in class GenericServlet
javax.servlet.GenericServlet
ServletException
- if an exception occurs that
interrupts the servlet's
normal operationpublic void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
service
in class HttpServlet
req
- The servlet request.resp
- The servlet response.public static void registerFilter(String path, Filter f, int priority)
path
- The relative URL path to filterf
- A Filter adapterpriority
- The priority (lower is higher priority)Filter
public static void registerFilter(String path, Filter f)
path
- The relative URL path to filterf
- A Filter adapterFilter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |