|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.webobjects.jspservlet.WOServletAdaptor
This class
is an adaptor that allows a WebObjects application to appear as a
servlet to a servlet container, using the normal doGet/Post methods.
This is not a subclass of WOAdaptor. Nor does it participate
in the normal WOAdaptor registration/unregistration/request handling.
Instead, it is a subclass of HttpServlet. This class is not intended to be subclassed.
It also provides the static APIs embeddedComponentResponse
and embeddedDirectActionResponse
which, combined with the provided
taglib, allows JSP developers to embed WOComponents and Direct Actions
in their pages. embeddedComponentResponse
and embeddedDirectActionResponse
may also be used directly from a Servlet.
Inner Class Summary | |
static class |
WOServletAdaptor.JavaArchiveFilter
|
Constructor Summary | |
WOServletAdaptor()
Empty default constructor that just calls super(). |
Method Summary | |
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,
HashMap bindings,
HashMap extraHeaders,
javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
com.webobjects.jspservlet.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,
HashMap bindings,
HashMap extraHeaders,
com.webobjects.jspservlet.PageContext pageContext,
boolean bodyContentOnly,
boolean mergeResponseHeaders)
|
static String |
embeddedDirectActionResponse(String actionName,
String className,
HashMap formValues,
InputStream contentStream,
HashMap extraHeaders,
javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
com.webobjects.jspservlet.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,
HashMap formValues,
InputStream contentStream,
HashMap extraHeaders,
com.webobjects.jspservlet.PageContext pageContext,
boolean bodyContentOnly,
boolean mergeResponseHeaders)
|
void |
init()
Default init method that just calls initStatics |
static void |
initStatics(com.webobjects.jspservlet.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. |
Constructor Detail |
public WOServletAdaptor() throws javax.servlet.ServletException
Method Detail |
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
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.request
- the HttpServletRequestresponse
- the HttpServletResponsepublic void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
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.request
- the HttpServletRequestresponse
- the HttpServletResponseprotected static String embeddedComponentResponse(String name, HashMap bindings, HashMap extraHeaders, com.webobjects.jspservlet.PageContext pageContext, boolean bodyContentOnly, boolean mergeResponseHeaders)
public static String embeddedComponentResponse(String name, HashMap bindings, HashMap extraHeaders, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, com.webobjects.jspservlet.HttpServlet servlet, boolean bodyContentOnly, boolean mergeResponseHeaders)
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.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 ServletservletResponse
- the response object as seen by the invoking Servletservlet
- the invoking servlet itselfbodyContentOnly
- whether to extract the content of the response for returnmergeResponseHeaders
- whether to merge the WOResponse headers into servletResponseprotected static String embeddedDirectActionResponse(String actionName, String className, HashMap formValues, InputStream contentStream, HashMap extraHeaders, com.webobjects.jspservlet.PageContext pageContext, boolean bodyContentOnly, boolean mergeResponseHeaders)
public static String embeddedDirectActionResponse(String actionName, String className, HashMap formValues, InputStream contentStream, HashMap extraHeaders, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, com.webobjects.jspservlet.HttpServlet servlet, boolean bodyContentOnly, boolean mergeResponseHeaders)
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.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 ServletservletResponse
- the response object as seen by the invoking Servletservlet
- the invoking servlet itselfbodyContentOnly
- whether to extract the content of the response for returnmergeResponseHeaders
- whether to merge the WOResponse headers into servletResponsepublic void init() throws javax.servlet.ServletException
public static void initStatics(com.webobjects.jspservlet.ServletContext servletContext)
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.public String toString()
classpath
, the mainBundlePath
,
the name of the WOApplication subclass, as well as the ServletConfig and ServletContextpublic static Object woApplicationObject()
initStatics
, embeddedComponentResponse
, embeddedDirectActionResponse
,
or a Taglib must have been invoked previous to calling this.
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |