Class BrazilServlet

  extended by javax.servlet.GenericServlet
      extended by sunlabs.brazil.servlet.BrazilServlet (view source)
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public final class BrazilServlet
extends GenericServlet

This is the Brazil Toolkit Servlet Adapter. It allows one to run applications built with the Brazil Toolkit in any web server that provides a Servlet container that implements the Servlet 2.2 API.

The servlet should be installed as a web application as specified in the Java Servlet Specification, v2.2. The servlet deployment descriptor should create a configuration that causes the request path to consist of only the context path and pathInfo elements. There should not be a servlet path element. See section 5 of the specification for more details (note that the definitions of each path element are are more accurately stated in the 2.3 specification). The deployment descriptor should be similar to the following:

     <display-name>BrazilServlet servlet container for Brazil</display-name>
        This servlet wraps the Brazil Toolkit so it can run within
        any web server environment that supports the 2.2 Servlet API
The default configuration file for the Brazil application is loaded from the system resource /sunlabs/brazil/server/config. Additional configuration files, which may override properties in the default file, are searched by looking at the "|" separated list of file names associated with config servlet parameter. File names that are not "absolute" are located relative to the servlet context root If no config servlet parameter is defined, the file named "config" (if any) in the servlet context root is used.

The Brazil root property if obtained from the "root" servlet parameter. If none is provided, the "root" property from the configuration files (last one wins) is used. As before, relative root directories are resolved with respect to the servlet context root.

The following properties are set by this class:

The original URL requested by the client.
The servlet context path
The servlet's name
The name of the servlet container

See Also:
BServletSocket, BServletServerSocket, BServletRequest, Serialized Form

Constructor Summary
Method Summary
 void destroy()
          Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.
 void init(ServletConfig config)
          Called by the servlet container to place the servlet into service.
 void service(ServletRequest req, ServletResponse res)
          Called by the servlet container to allow the servlet to respond to a request.
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public BrazilServlet()
Method Detail


public void init(ServletConfig config)
          throws ServletException
Called by the servlet container to place the servlet into service.

Specified by:
init in interface Servlet
init in class GenericServlet
config - the ServletConfig object that contains configuration information for this servlet
ServletException - if an exception occurs that interrupts the servlet's normal operation
See Also:


public void service(ServletRequest req,
                    ServletResponse res)
             throws ServletException,
Called by the servlet container to allow the servlet to respond to a request.

This method implements the abstract method declared in the GenericServlet super class.

Specified by:
service in interface Servlet
Specified by:
service in class GenericServlet
req - the ServletRequest object that contains the client's request
res - the ServletResponse object that will contain the servlet's response
ServletException - if an exception occurs that interferes with the servlet's normal operation occurred
IOException - if an input or output exception occurs
See Also:
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)


public void destroy()
Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.

Specified by:
destroy in interface Servlet
destroy in class GenericServlet
See Also:

Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.