Package sunlabs.brazil.servlet

Run a Brazil application as a Servlet.


Class Summary
BrazilServlet This is the Brazil Toolkit Servlet Adapter.
BServletRequest This is a subclass of Request that is used by BrazilServlet to map servlet style requests and responses to and from Brazil style requests.
BServletRequest.HttpOutputStream An HttpOutputStream that is used by the Brazil Servlet adaptor to add the web application context path to the front of all response URI's so subsequent requests will be mapped to the BrazilServlet's context.
BServletServerSocket This is a special ServerSocket intended for use by the Brazil Servlet Adapter.
BServletSocket This is a special Socket intended for use by the Brazil Servlet Adapter.

Package sunlabs.brazil.servlet Description

Run a Brazil application as a Servlet. 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 at least the Servlet 2.2 API

When running a Brazil application as a servlet, sunlabs.brazil.server.Main is not used to start the application; the servlet container starts the application instead. The deployment descriptor parameters config and root are used to locate the Brazil server configuration files, and to define the document root, respectively.

To allow identical Brazil configurations to operate unchanged, either standalone or as a servlet, the application context portion of the URL is removed before Brazil handlers access requests. Similarly, any HTML content produced by the Brazil application is re-written to prepend the application context onto any rooted (e.g. starts with '/') URL.

For example, if a brazil application is deployed in the servlet context: brazil-servlet, then an http request to the server of the form:
will appear to the Brazil application with a URL of:
. An HTML response from the Brazil application of the form:
<a href="/foo.html"> ...
will automatically be rewritten to:
<a href="/brazil-servlet/foo.html"> ...

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



See BrazilServlet for more instructions.

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