com.arsdigita.acs
Class RequestProcessor
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--com.arsdigita.acs.RequestProcessor
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class RequestProcessor
- extends javax.servlet.http.HttpServlet
Request procesor servlet for ACS -- handles abstract URLs and sets
up request/session/package objects.
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. This is necessary
for dynamically mapping and re-mapping virtual paths to packages at
the application layer, so that a package (e.g., packages/bboard)
can be mounted on multiple URLs (/service/discussion,
/service/forum, etc.)
When a request comes in:
- We build an ACSSession object for the session, which reads the
cookies from the request; this object's methods are used to find out
who's logged in and authenticate the user.
- We try to resolve the request for a URL to a package instance
by building ACSRequest and ACSPackage objects.
- If we don't resolve the request to a package, we assume it's in the
global pageroot (/www). Otherwise we resolve the requested page to
/packages/PACKAGE-KEY/path/file.
- Check to make sure that the user is authorized to access the
particular object id/site node.
- If the requested file is an "abstract" pathname (without extension),
we resolve the URL to a file by trying different extensions
- Once we have the exact URL of the file to be served, we grab the
proper handling servlet for the file by URL and forward the request.
- When there is no servlet explicitly mapped to handle a
particular file (e.g., static HTML, graphics, etc.), the servlet
engine will forward the request for /path/page.{gif,jpeg,html,etc.}
to the RequestProcessor servlet a second time, because it is
mounted on "/". The RequestProcessor detects re-entrant calls and
then forwards to the named "default" servlet to serve the page.
(NB: the "default" servlet must be registered/published in web.xml)
- See Also:
- Serialized Form
|
Field Summary |
static java.lang.String |
cvsId
|
| 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 |
cvsId
public static final java.lang.String cvsId
RequestProcessor
public RequestProcessor()
getInstance
public static RequestProcessor getInstance()
- Returns the currently-loaded instance of the request
processor servlet.
- Returns:
- The current JVM's RequestProcessor instance.
init
public void init()
throws javax.servlet.ServletException
- Called when servlet is loaded, and sets static instance.
Also initializes an instance of the AJP compiler.
- Overrides:
init in class javax.servlet.GenericServlet
service
public void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
java.io.IOException
- Handles an abstract URL in the request req, and sets up objects
for the session, request, and package.
Forwards the request as appropriate.
- Overrides:
service in class javax.servlet.http.HttpServlet
- Parameters:
req - The servlet request.resp - The servlet response.
runTranslations
public static java.lang.String runTranslations(java.lang.String originalUrl,
java.io.File fileToTranslate)
throws javax.servlet.ServletException
getSupportedExtensions
public static java.util.ArrayList getSupportedExtensions()
registerTranslatorHandler
public static void registerTranslatorHandler(java.lang.String ext,
TranslatorHandler h)
registerExtensionHandler
public static void registerExtensionHandler(java.lang.String ext,
ExtensionHandler h)