|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.xml.xmlc.servlet.XMLCContext
Class to facility the use of XMLC in a HTTP servlet. This object contains a XMLC factory to create instances of XMLC document classes and methods to output documents.
An instance of this object is associated with the ServletContext object
for an application (one per WebApp). The object is created on first use by
getContext
. It provides a factory for creating XMLC
document class with optional automatic reloading of out of date classes
or recompilation and reloading of classes out-of-date relative to a source
file. Also provided are methods to output a XMLC document as a HTTP response,
with automatic setting of response content type.
Instance of this class are configured using the following Servlet context-wide init parameters:
XMLCLogger
and
define a constructor with a signature of (ServletContext
context, boolean enableInfo, boolean
enableDebug)
(same as ServletXMLCLogger
).
ServletContext
Inner Class Summary | |
static class |
XMLCContext.SessionURLEncodingMode
Enumerated constant indicating how URL session encoding is to be handled. |
Field Summary | |
static String |
CONTEXT_ATTRIBUTE
Name of ServletContext attribute that contains the instance of this class for a WebApp. |
static XMLCContext.SessionURLEncodingMode |
URL_ENCODING_ALWAYS
Value indicating that URL session encoding should always be used. |
static XMLCContext.SessionURLEncodingMode |
URL_ENCODING_AUTO
Value indicating that URL session encoding should be detected automatically based on if it was used for the current requested. |
static XMLCContext.SessionURLEncodingMode |
URL_ENCODING_NEVER
Value indicating that URL session encoding should never be used. |
(package private) static int |
XMLC_COMPRESS_GZIP
|
(package private) static int |
XMLC_COMPRESS_NONE
Definition of xmlcCompression parameter values as a bit set. |
Constructor Summary | |
XMLCContext(javax.servlet.ServletContext servletContext,
XMLCFactory factory,
XMLCContext.SessionURLEncodingMode sessionURLEncodingMode,
boolean logStats,
int compressionType)
Constructor. |
Method Summary | |
OutputOptions |
createOutputOptions(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
XMLObject document)
Create an OutputOptions object for a document. |
static XMLCContext |
getContext(javax.servlet.http.HttpServlet servlet)
Obtain the XMLCContext for the current application, creating it if it doesn't exist. |
static XMLCContext |
getContext(javax.servlet.ServletContext servletContext)
Obtain the XMLCContext for the current application, creating it if it doesn't exist. |
protected javax.servlet.ServletContext |
getServletContext()
Get the associated servlet context |
XMLCContext.SessionURLEncodingMode |
getSessionURLEncoding()
|
XMLCFactory |
getXMLCFactory()
Get the XMLC factory object associated with the context. |
void |
setSessionURLEncoding(XMLCContext.SessionURLEncodingMode mode)
Set the session URL encoding mode. |
protected URLRewriter |
setupURLRewriter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Setup the session URL encoder as required by configuration and request. |
void |
setXMLCFactory(XMLCFactory factory)
Explictly set XMLC factory. |
protected boolean |
shouldEncodeSessionId(javax.servlet.http.HttpServletRequest request)
Determine if a session id should be encoded URLs. |
void |
writeDOM(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
OutputOptions outputOptions,
XMLObject document)
Output an an XMLC document object (DOM). |
void |
writeDOM(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
XMLObject document)
Output an an XMLC document object (DOM). |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final XMLCContext.SessionURLEncodingMode URL_ENCODING_AUTO
public static final XMLCContext.SessionURLEncodingMode URL_ENCODING_ALWAYS
public static final XMLCContext.SessionURLEncodingMode URL_ENCODING_NEVER
public static final String CONTEXT_ATTRIBUTE
static final int XMLC_COMPRESS_NONE
static final int XMLC_COMPRESS_GZIP
Constructor Detail |
public XMLCContext(javax.servlet.ServletContext servletContext, XMLCFactory factory, XMLCContext.SessionURLEncodingMode sessionURLEncodingMode, boolean logStats, int compressionType)
getContext
.Method Detail |
public XMLCFactory getXMLCFactory()
public void setXMLCFactory(XMLCFactory factory)
public void setSessionURLEncoding(XMLCContext.SessionURLEncodingMode mode)
mode
- Constant indicating what mode to useXMLCContext.SessionURLEncodingMode
public XMLCContext.SessionURLEncodingMode getSessionURLEncoding()
protected boolean shouldEncodeSessionId(javax.servlet.http.HttpServletRequest request)
protected URLRewriter setupURLRewriter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public OutputOptions createOutputOptions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, XMLObject document)
The following attributes are set in the object:
request
- The servlet request object. The request is required
to determine if URL encoding should be done on the document.response
- The servlet response object. The response is required
to set up the URL encoder.document
- The DOM object to be returned as response.public void writeDOM(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, OutputOptions outputOptions, XMLObject document) throws IOException
request
- The servlet request object. The request is required
to determine if URL encoding should be done on the document.response
- The servlet response object. The
Content-Type and Content-Length will be set from
the document..outputFormat
- Object use to specify options controlling the
formatting of the document.document
- The DOM object to be returned as response.public void writeDOM(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, XMLObject document) throws IOException
request
- The servlet request object. The request is required
to determine if URL encoding should be done on the document.response
- The servlet response object. The
Content-Type and Content-Length will be set from
the document..document
- The DOM object to be returned as response.public static XMLCContext getContext(javax.servlet.http.HttpServlet servlet)
servlet
- A servlet in the application. Used to obtain the servlet context.getContext(ServletContext)
public static XMLCContext getContext(javax.servlet.ServletContext servletContext)
servletContext
- The servlet context of this application.protected javax.servlet.ServletContext getServletContext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |