|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.apache.cocoon.servlet.CocoonServlet
public class CocoonServlet
This is the entry point for Cocoon execution as an HTTP Servlet.
Field Summary | |
---|---|
protected static boolean |
ALLOW_RELOAD
Default value for allowReload parameter (false) |
protected boolean |
allowReload
Allow reloading of cocoon by specifying the cocoon-reload=true parameter with a request |
protected DefaultContext |
appContext
Avalon application context |
protected ClassLoader |
classLoader
The classloader that will be set as the context classloader if init-classloader is true |
protected Cocoon |
cocoon
The Cocoon instance |
static String |
CONTEXT_SERVLET_CONFIG
Application Context Key for the servlet configuration |
protected long |
creationTime
The time the cocoon instance was created |
protected Exception |
exception
Holds exception happened during initialization (if any) |
protected String |
forceLoadParameter
|
protected String |
forceSystemProperty
|
protected boolean |
hiddenShowTime
If true, processing time will be added as an HTML comment |
protected boolean |
initClassLoader
|
protected static String |
PROCESSED_BY
|
protected RequestFactory |
requestFactory
The RequestFactory is responsible for wrapping multipart-encoded forms and for handing the file payload of incoming requests |
protected ServletContext |
servletContext
|
protected String |
servletContextPath
This is the path to the servlet context (or the result of calling getRealPath('/') on the ServletContext. |
protected String |
servletContextURL
This is the url to the servlet context directory |
protected boolean |
showTime
Allow adding processing time to the response |
Constructor Summary | |
---|---|
CocoonServlet()
|
Method Summary | |
---|---|
protected void |
addClassLoaderDirectory(String dir)
Adds a directory to the classloader. |
protected void |
addClassLoaderURL(URL URL)
Adds an URL to the classloader. |
protected void |
createCocoon()
Creates the Cocoon object and handles exception handling. |
void |
destroy()
Dispose Cocoon when servlet is destroyed |
protected void |
disposeCocoon()
Destroy Cocoon |
protected String |
getClassPath()
This builds the important ClassPath used by this Servlet. |
protected Environment |
getEnvironment(String uri,
HttpServletRequest req,
HttpServletResponse res)
Create the environment for the request |
protected String |
getExtraClassPath()
Retreives the "extra-classpath" attribute, that needs to be added to the class path. |
String |
getInitParameter(String name)
Get an initialisation parameter. |
protected String |
getInitParameter(String name,
String defaultValue)
Convenience method to access servlet parameters |
protected boolean |
getInitParameterAsBoolean(String name,
boolean defaultValue)
Convenience method to access boolean servlet parameters |
protected int |
getInitParameterAsInteger(String name,
int defaultValue)
|
protected Logger |
getLogger()
|
protected LoggerManager |
getLoggerManager()
|
protected ComponentManager |
getParentComponentManager()
Instatiates the parent component manager, as specified in the parent-component-manager init parameter. |
void |
init(ServletConfig conf)
Initialize this CocoonServlet instance. |
protected void |
initLogger()
Set up the log level and path. |
protected void |
manageException(HttpServletRequest req,
HttpServletResponse res,
Environment env,
String uri,
int errorStatus,
String title,
String message,
String description,
Exception e)
|
void |
service(HttpServletRequest req,
HttpServletResponse res)
Process the specified HttpServletRequest producing output
on the specified HttpServletResponse . |
protected void |
updateEnvironment()
Method to update the environment before Cocoon instances are created. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
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 |
Field Detail |
---|
public static final String CONTEXT_SERVLET_CONFIG
Context
Key for the servlet configuration
protected static final String PROCESSED_BY
protected long creationTime
protected Cocoon cocoon
Cocoon
instance
protected Exception exception
protected DefaultContext appContext
protected static final boolean ALLOW_RELOAD
allowReload
parameter (false)
protected boolean allowReload
cocoon-reload=true
parameter with a request
protected boolean showTime
protected boolean hiddenShowTime
protected ServletContext servletContext
protected ClassLoader classLoader
protected boolean initClassLoader
protected String forceLoadParameter
protected String forceSystemProperty
protected String servletContextPath
protected String servletContextURL
protected RequestFactory requestFactory
Constructor Detail |
---|
public CocoonServlet()
Method Detail |
---|
public void init(ServletConfig conf) throws ServletException
CocoonServlet
instance. You will
notice that I have broken the init into sub methods to make it
easier to maintain (BL). The context is passed to a couple of
the subroutines. This is also because it is better to explicitly
pass variables than implicitely. It is both more maintainable,
and more elegant.
init
in interface Servlet
init
in class GenericServlet
conf
- The ServletConfig object from the servlet engine.
ServletException
public void destroy()
destroy
in interface Servlet
destroy
in class GenericServlet
protected void addClassLoaderURL(URL URL)
ParanoidCocoonServlet
.
protected void addClassLoaderDirectory(String dir)
ParanoidCocoonServlet
.
protected String getClassPath() throws ServletException
ServletContext
's getRealPath
method
to get the Servlet 2.2 identified classes and lib directories.
It iterates in alphabetical order through every file in the
lib directory and adds it to the classpath.
Also, we add the files to the ClassLoader for the Cocoon system.
In order to protect ourselves from skitzofrantic classloaders,
we need to work with a known one.
We need to get this to work properly when Cocoon is in a war.
ServletException
protected String getExtraClassPath() throws ServletException
ServletException
protected void initLogger()
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
HttpServletRequest
producing output
on the specified HttpServletResponse
.
service
in class HttpServlet
ServletException
IOException
protected void manageException(HttpServletRequest req, HttpServletResponse res, Environment env, String uri, int errorStatus, String title, String message, String description, Exception e) throws IOException
IOException
protected Environment getEnvironment(String uri, HttpServletRequest req, HttpServletResponse res) throws Exception
Exception
protected ComponentManager getParentComponentManager()
null
.
null
.protected void createCocoon() throws ServletException
ServletException
protected void updateEnvironment() throws ServletException
ServletException
protected final void disposeCocoon()
public String getInitParameter(String name)
getInitParameter
in interface ServletConfig
getInitParameter
in class GenericServlet
protected String getInitParameter(String name, String defaultValue)
protected boolean getInitParameterAsBoolean(String name, boolean defaultValue)
protected int getInitParameterAsInteger(String name, int defaultValue)
protected Logger getLogger()
protected LoggerManager getLoggerManager()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |