org.apache.cocoon.servlet
Class CocoonServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.apache.cocoon.servlet.CocoonServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class CocoonServlet
extends HttpServlet

This is the entry point for Cocoon execution as an HTTP Servlet.

Version:
$Id: CocoonServlet.java 325955 2005-10-17 18:44:53Z vgritsenko $
Author:
Pierpaolo Fumagalli (Apache Software Foundation), Stefano Mazzocchi, Nicola Ken Barozzi, Berin Loritsch, Carsten Ziegeler, Leo Sutic
See Also:
Serialized Form

Nested Class Summary
protected static class CocoonServlet.ServletBootstrapEnvironment
           
 
Field Summary
protected  Cocoon cocoon
          The Cocoon instance
static String CONTEXT_SERVLET_CONFIG
          Application Context Key for the servlet configuration
protected  CoreUtil coreUtil
          CoreUtil
protected  Context environmentContext
           
protected  Exception exception
          Holds exception happened during initialization (if any)
protected  Logger log
          The logger
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
 
Constructor Summary
CocoonServlet()
           
 
Method Summary
 void destroy()
          Dispose Cocoon when servlet is destroyed
protected  Environment getEnvironment(String uri, HttpServletRequest req, HttpServletResponse res)
          Create the environment for the request
 String getInitParameter(String name)
          Get an initialisation parameter.
protected  String getInitParameter(String name, String defaultValue)
          Convenience method to access servlet parameters
protected  Logger getLogger()
           
 void init(ServletConfig conf)
          Initialize this CocoonServlet instance.
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.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, 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

CONTEXT_SERVLET_CONFIG

public static final String CONTEXT_SERVLET_CONFIG
Application Context Key for the servlet configuration

Since:
2.1.3
See Also:
Constant Field Values

PROCESSED_BY

protected static final String PROCESSED_BY

cocoon

protected Cocoon cocoon
The Cocoon instance


exception

protected Exception exception
Holds exception happened during initialization (if any)


servletContext

protected ServletContext servletContext

servletContextPath

protected String servletContextPath
This is the path to the servlet context (or the result of calling getRealPath('/') on the ServletContext. Note, that this can be null.


servletContextURL

protected String servletContextURL
This is the url to the servlet context directory


requestFactory

protected RequestFactory requestFactory
The RequestFactory is responsible for wrapping multipart-encoded forms and for handing the file payload of incoming requests


coreUtil

protected CoreUtil coreUtil
CoreUtil


log

protected Logger log
The logger


environmentContext

protected Context environmentContext
Constructor Detail

CocoonServlet

public CocoonServlet()
Method Detail

init

public void init(ServletConfig conf)
          throws ServletException
Initialize this 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.

Parameters:
conf - The ServletConfig object from the servlet engine.
Throws:
ServletException

destroy

public void destroy()
Dispose Cocoon when servlet is destroyed


service

public void service(HttpServletRequest req,
                    HttpServletResponse res)
             throws ServletException,
                    IOException
Process the specified HttpServletRequest producing output on the specified HttpServletResponse.

Throws:
ServletException
IOException

manageException

protected void manageException(HttpServletRequest req,
                               HttpServletResponse res,
                               Environment env,
                               String uri,
                               int errorStatus,
                               String title,
                               String message,
                               String description,
                               Exception e)
                        throws IOException
Throws:
IOException

getEnvironment

protected Environment getEnvironment(String uri,
                                     HttpServletRequest req,
                                     HttpServletResponse res)
                              throws Exception
Create the environment for the request

Throws:
Exception

getInitParameter

public String getInitParameter(String name)
Get an initialisation parameter. The value is trimmed, and null is returned if the trimmed value is empty.


getInitParameter

protected String getInitParameter(String name,
                                  String defaultValue)
Convenience method to access servlet parameters


getLogger

protected Logger getLogger()


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.