|
|||||||||
| Home >> All >> org >> enhydra >> xml >> xmlc >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.enhydra.xml.xmlc.servlet
Class XMLCContext

java.lang.Objectorg.enhydra.xml.xmlc.servlet.XMLCContext
- public class XMLCContext
- extends java.lang.Object
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 55 . 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:
- xmlcReloading - Control's the automatic reloading or
recompilation of XMLC document classes. The following values are
recognized.
- off - No automatic reloading or recompilation (default).
- reload - Automatic reloading of modified class files.
- recompile - Automatic recompilation of classes that are out of date relative to their source files and reloading of modified class files.
- xmlcSessionURLEncoding - Controls automatic encoding of session ID in
URLs.
- auto - Automatically enable session URL encoding as needed (default)
- always - Always enable session URL encoding.
- never - Never enable session URL encoding.
- xmlcLogging - Control's what runtime information XMLC logs.
The value is a space-seperated list of the following values:
- INFO - Log basic information about notable events, such as recompiling or reloading classes.
- DEBUG - Log debugging information. Mostly related to recompiling and reloading.
- STATS - Log statistics information useful in debugging performance problems. Currently writes information about each DOM that is written. This is especially useful in looking at the how much of a Lazy DOM has been expanded.
| Nested Class Summary | |
static class |
XMLCContext.SessionURLEncodingMode
Enumerated constant indicating how URL session encoding is to be handled. |
| Field Summary | |
static java.lang.String |
CONTEXT_ATTRIBUTE
Name of ServletContext attribute that contains the instance of this class for a WebApp. |
private org.enhydra.xml.xmlc.XMLCFactory |
fFactory
|
private boolean |
fLogStats
|
private javax.servlet.ServletContext |
fServletContext
The servlet context we are associated with. |
private XMLCContext.SessionURLEncodingMode |
fSessionURLEncodingMode
|
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. |
| Constructor Summary | |
(package private) |
XMLCContext(javax.servlet.ServletContext servletContext,
org.enhydra.xml.xmlc.XMLCFactory factory,
XMLCContext.SessionURLEncodingMode sessionURLEncodingMode,
boolean logStats)
Constructor; instances can only be created through (getContext 55 . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
URL_ENCODING_AUTO
public static final 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.
URL_ENCODING_ALWAYS
public static final XMLCContext.SessionURLEncodingMode URL_ENCODING_ALWAYS
- Value indicating that URL session encoding should always be used.
URL_ENCODING_NEVER
public static final XMLCContext.SessionURLEncodingMode URL_ENCODING_NEVER
- Value indicating that URL session encoding should never be used.
CONTEXT_ATTRIBUTE
public static final java.lang.String CONTEXT_ATTRIBUTE
- Name of ServletContext attribute that contains the instance of this class
for a WebApp.
- See Also:
- Constant Field Values
fServletContext
private javax.servlet.ServletContext fServletContext
- The servlet context we are associated with.
fFactory
private org.enhydra.xml.xmlc.XMLCFactory fFactory
fSessionURLEncodingMode
private XMLCContext.SessionURLEncodingMode fSessionURLEncodingMode
fLogStats
private boolean fLogStats
| Constructor Detail |
XMLCContext
XMLCContext(javax.servlet.ServletContext servletContext, org.enhydra.xml.xmlc.XMLCFactory factory, XMLCContext.SessionURLEncodingMode sessionURLEncodingMode, boolean logStats)
- Constructor; instances can only be created through
(getContext 55 .
| Method Detail |
getXMLCFactory
public org.enhydra.xml.xmlc.XMLCFactory getXMLCFactory()
- Get the XMLC factory object associated with the context.
setXMLCFactory
public void setXMLCFactory(org.enhydra.xml.xmlc.XMLCFactory factory)
- Explictly set XMLC factory. The XMLC factory is normally defined base
on the servlet configuration parameters. This allows the user to
overide the standard factories.
setSessionURLEncoding
public void setSessionURLEncoding(XMLCContext.SessionURLEncodingMode mode)
- Set the session URL encoding mode. This option is normally set from
the servlet configuration parameters. This allows the explicit setting
of this option.
getSessionURLEncoding
public XMLCContext.SessionURLEncodingMode getSessionURLEncoding()
shouldEncodeSessionId
private boolean shouldEncodeSessionId(javax.servlet.http.HttpServletRequest request)
- Determine if a session id should be encoded URLs.
setupURLRewriter
private org.enhydra.xml.io.URLRewriter setupURLRewriter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
- Setup the session URL encoder as required by configuration and
request.
setupEncoding
private void setupEncoding(javax.servlet.http.HttpServletResponse response, org.enhydra.xml.xmlc.XMLObject document, org.enhydra.xml.io.OutputOptions options)
- Set up the encoding using the encoding specified, OutputOptions,
the response, or the XMLC default encoding. Modifies OutputOptions.
createOutputOptions
public org.enhydra.xml.io.OutputOptions createOutputOptions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.enhydra.xml.xmlc.XMLObject document)
- Create an OutputOptions object for a document. Options are defaulted for
the specified document. The object maybe then modified as needed to
override the default values.
The following attributes are set in the object:
- encoding
- MIME type - Defaults for document.
- URLRewriter - Set if URL encoding of sessions is enabled.
outputHeaders
private void outputHeaders(javax.servlet.http.HttpServletResponse response, int docLength, java.lang.String mimeEncoding, java.lang.String mimeType) throws java.io.IOException
- Write headers, disabling caching if other policy is not already
set.
logDocumentStats
private void logDocumentStats(org.enhydra.xml.xmlc.XMLObject document)
- Output document statistics.
outputDocument
private void outputDocument(javax.servlet.http.HttpServletResponse response, org.enhydra.xml.xmlc.XMLObject document, org.enhydra.xml.io.OutputOptions outputOptions) throws java.io.IOException
- Do common operations for writing DOM document. Sets approriate HTTP
header, including setting of cache-control headers, if not already set.
Handles encoding conversion and output.
writeDOM
public void writeDOM(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.enhydra.xml.io.OutputOptions outputOptions, org.enhydra.xml.xmlc.XMLObject document) throws java.io.IOException
- Output an an XMLC document object (DOM). The document is formatted
according to it's type. The MIME type of the response is automatically
set.
writeDOM
public void writeDOM(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.enhydra.xml.xmlc.XMLObject document) throws java.io.IOException
- Output an an XMLC document object (DOM). The document is formatted
according to it's type. The MIME type of the response is automatically
set.
getContext
public static XMLCContext getContext(javax.servlet.http.HttpServlet servlet)
- Obtain the XMLCContext for the current application, creating it if
it doesn't exist.
|
|||||||||
| Home >> All >> org >> enhydra >> xml >> xmlc >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.enhydra.xml.xmlc.servlet.XMLCContext