WebObjects 5.4.2

com.webobjects.jspservlet
Class WOServletAdaptor

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.webobjects.jspservlet.WOServletAdaptor
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class WOServletAdaptor
extends javax.servlet.http.HttpServlet

See Also:
Serialized Form

Nested Class Summary
static class WOServletAdaptor.JavaArchiveFilter
           
 
Constructor Summary
WOServletAdaptor()
          Empty default constructor that just calls super().
 
Method Summary
 void destroy()
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Method for GET requests.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Method for POST requests.
static String embeddedComponentResponse(String name, Map bindings, Map extraHeaders, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, javax.servlet.http.HttpServlet servlet, boolean bodyContentOnly, boolean mergeResponseHeaders)
          Returns a String representing the generated content for a given WOComponent with name.
protected static String embeddedComponentResponse(String name, Map bindings, Map extraHeaders, javax.servlet.jsp.PageContext pageContext, boolean bodyContentOnly, boolean mergeResponseHeaders)
           
static String embeddedDirectActionResponse(String actionName, String className, Map formValues, InputStream contentStream, Map extraHeaders, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, javax.servlet.http.HttpServlet servlet, boolean bodyContentOnly, boolean mergeResponseHeaders)
          Returns a String representing the generated content for a given direct action with actionName.
protected static String embeddedDirectActionResponse(String actionName, String className, Map formValues, InputStream contentStream, Map extraHeaders, javax.servlet.jsp.PageContext pageContext, boolean bodyContentOnly, boolean mergeResponseHeaders)
           
 void init()
          Default init method that just calls initStatics
static void initStatics(javax.servlet.ServletContext servletContext)
          Initializes all the appropriate objects so that JSP/Servlet integration works.
 String toString()
          String representation of this class, which includes the classpath, the mainBundlePath, the name of the WOApplication subclass, as well as the ServletConfig and ServletContext
static Object woApplicationObject()
          Returns the WOApplication class (or subclass) used by this application.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WOServletAdaptor

public WOServletAdaptor()
                 throws javax.servlet.ServletException
Empty default constructor that just calls super().

Throws:
javax.servlet.ServletException
Method Detail

initStatics

public static void initStatics(javax.servlet.ServletContext servletContext)
                        throws javax.servlet.UnavailableException
Initializes all the appropriate objects so that JSP/Servlet integration works. Normally, this method should never be called, since either calling embeddedComponentResponse or having the servlet container initialize the WOServletAdaptor object will do everything for you. However, if you are planning on using WebObjects objects directly in either a JSP or Servlet, you must invoke this method first. Further invocations of this method past the first will do nothing.

Throws:
javax.servlet.UnavailableException

woApplicationObject

public static Object woApplicationObject()
Returns the WOApplication class (or subclass) used by this application. initStatics, embeddedComponentResponse, embeddedDirectActionResponse, or a Taglib must have been invoked previous to calling this.

Returns:
Object the uncast WOApplication object.

embeddedComponentResponse

protected static String embeddedComponentResponse(String name,
                                                  Map bindings,
                                                  Map extraHeaders,
                                                  javax.servlet.jsp.PageContext pageContext,
                                                  boolean bodyContentOnly,
                                                  boolean mergeResponseHeaders)

embeddedComponentResponse

public static String embeddedComponentResponse(String name,
                                               Map bindings,
                                               Map extraHeaders,
                                               javax.servlet.http.HttpServletRequest servletRequest,
                                               javax.servlet.http.HttpServletResponse servletResponse,
                                               javax.servlet.http.HttpServlet servlet,
                                               boolean bodyContentOnly,
                                               boolean mergeResponseHeaders)
Returns a String representing the generated content for a given WOComponent with name. The bindings for that WOComponent are passed in bindings. extraHeaders are headers that will be added to the WORequest as seen by the WOComponent -- note that all the headers that are part of the HttpServletRequest are included automatically. The servletRequest, servletResponse and servlet are passed in for possible use later. If bodyContentOnly is true, only text between the first tag and the last tag will be returned. If mergeResponseHeaders is true, the response headers for the WOComponent will be merged into the servletResponse. Note that all the servlet objects will be stored in the userInfo dictionary argument of WOApplication.responseForComponentWithName. This API is designed to be invoked from inside a Servlet -- for embedding components within JSP pages, use the taglib instead.

Parameters:
name - the name of the WOComponent that should generate the response.
bindings - the bindings for the WOComponent; they can be any type of object.
extraHeaders - extra headers to merge into the WORequest as the WOComponent will see it (optional)
servletRequest - the request object as seen by the invoking Servlet
servletResponse - the response object as seen by the invoking Servlet
servlet - the invoking servlet itself
bodyContentOnly - whether to extract the content of the response for return
mergeResponseHeaders - whether to merge the WOResponse headers into servletResponse
Returns:
a String representing the component response

embeddedDirectActionResponse

protected static String embeddedDirectActionResponse(String actionName,
                                                     String className,
                                                     Map formValues,
                                                     InputStream contentStream,
                                                     Map extraHeaders,
                                                     javax.servlet.jsp.PageContext pageContext,
                                                     boolean bodyContentOnly,
                                                     boolean mergeResponseHeaders)

embeddedDirectActionResponse

public static String embeddedDirectActionResponse(String actionName,
                                                  String className,
                                                  Map formValues,
                                                  InputStream contentStream,
                                                  Map extraHeaders,
                                                  javax.servlet.http.HttpServletRequest servletRequest,
                                                  javax.servlet.http.HttpServletResponse servletResponse,
                                                  javax.servlet.http.HttpServlet servlet,
                                                  boolean bodyContentOnly,
                                                  boolean mergeResponseHeaders)
Returns a String representing the generated content for a given direct action with actionName. The Direct Action className may be specified as well, but is optional. formValues are passed to the direct action as a query string, while the contentString is just passed as regular content -- if the content requires special headers to process use extraHeaders. extraHeaders are headers that will be added to the WORequest as seen by the Direct Action -- note that all the headers that are part of the HttpServletRequest are included automatically. The servletRequest, servletResponse and servlet are passed in for possible use later. If bodyContentOnly is true, only text between the first BODY tag and the last BODY tag will be returned. If mergeResponseHeaders is true, the response headers for the WOComponent will be merged into the servletResponse. Note that all the servlet objects will be stored in the userInfo dictionary argument of WOApplication.responseForComponentWithName. This API is designed to be invoked from inside a Servlet -- for embedding direct actions within JSP pages, use the taglib instead.

Parameters:
actionName - the name of the direct action that should generate the response.
className - the name of the class that the direct action is in (optional)
formValues - the formValues to pass to the direct action, passed as a queryString (optional)
contentStream - the content to pass to the direct action (optional)
extraHeaders - extra headers to merge into the WORequest as the direct action will see it (optional)
servletRequest - the request object as seen by the invoking Servlet
servletResponse - the response object as seen by the invoking Servlet
servlet - the invoking servlet itself
bodyContentOnly - whether to extract the content of the response for return
mergeResponseHeaders - whether to merge the WOResponse headers into servletResponse
Returns:
a String representing the direct action response.

init

public void init()
          throws javax.servlet.ServletException
Default init method that just calls initStatics

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws IOException,
                   javax.servlet.ServletException
Method for POST requests. The request will be parsed and translated into a WORequest, and handed off to the WOApplication object. The WOResponse from the WOApplication will be parsed and translated into the HttpServletResponse. This, along with doGet, allows a WOApp to run inside of a Servlet container unchanged.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - the HttpServletRequest
response - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws IOException,
                  javax.servlet.ServletException
Method for GET requests. The request will be parsed and translated into a WORequest, and handed off to the WOApplication object. The WOResponse from the WOApplication will be parsed and translated into the HttpServletResponse. This, along with doPost, allows a WOApp to run inside of a Servlet container unchanged.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - the HttpServletRequest
response - the HttpServletResponse
Throws:
IOException
javax.servlet.ServletException

toString

public String toString()
String representation of this class, which includes the classpath, the mainBundlePath, the name of the WOApplication subclass, as well as the ServletConfig and ServletContext

Overrides:
toString in class Object
Returns:
the string representation of this class

Last updated June 2008

Copyright © 2000-2008 Apple Inc.