| de.schlund.pfixxml.ServletManager de.schlund.pfixxml.DirectOutputServlet
DirectOutputServlet | public class DirectOutputServlet extends ServletManager (Code) | | The DirectOutputServlet is a servlet that hijacks the
de.schlund.pfixcore.workflow.Context of a
comapnion ContextXMLServlet that runs in the same servlet session.
It has no Context of it's own, but rather makes all the work itself, as
there is no PageFlow handling involved.
Instead of
de.schlund.pfixcore.workflow.State s (as the Context of a ContextXMLServlet
does) this kind of Servlet uses so called
DirectOutputStates . These can write their output directly to the HttpServletResponse
object. So there is also no XML/XSLT transformation involved.
You can use this construct whenever you need to make things like
images, pdfs available for download and you can not simply write out a static file.
Consider e.g. a autogenerated pdf that needs information that is saved in some ContextResource.
A DirectOutputState can do this, as it has the possibility to work with the Context of a
foreign ContextXMLServlet servlet, getting all the information it needs from there, generating the
pdf and streaming it directly to the OutputStream of the HttpServletResponse.
If the foreign Context is of type AuthContext, the servlet
additionally checks, if the Context is authenticated before trying to call any DirectOutputState.
The servlet gets the foreign context by using the mandatory property
foreigncontextservlet.foreignservletname .
The value must be the servlet name of the ContextXMLServlet whose Context you want to use.
author: Jens Lautenbacher version: $Id: DirectOutputServlet.java 3092 2007-03-09 15:05:22Z smarsching $ |
allowSessionCreate | final protected boolean allowSessionCreate()(Code) | | allowSessionCreate returns false. If the session is being created
here, it will not have a saved Context anyway, so this makes no sense.
a boolean value |
needsSession | final protected boolean needsSession()(Code) | | The usual needsSession method. Is set to return
true, as any other value wouldn't make sense (You need to get a
Context from a running session after all)
a boolean value |
process | protected void process(PfixServletRequest preq, HttpServletResponse res) throws Exception(Code) | | process first tries to get the requested
Context. if the Context is of type AuthContext, it checks the
Authorization of the context first. After that, it asks the
de.schlund.pfixcore.workflow.DirectOutputPageMap for a
de.schlund.pfixcore.workflow.DirectOutputState that matches the current PageRequest (NOTE: this is NOT the
pagerequest that is returned from the foreign Context as the
current PageRequest!). The accessibility of the
DirectOutputState is checked, then the handleRequest(Context,
Properties, PfixServletRequest, HttpServletResponse) method of
the DirectOutputState is called. NOTE: The properties parameter
are the properties matching the current PageRequest. Again this
is not what the foreign context would return!
Parameters: preq - a PfixServletRequest value Parameters: res - a HttpServletResponse value exception: Exception - if an error occurs |
|
|