|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.benow.web.path.PathHandler
org.benow.web.path.FileBasedPathHandler
org.benow.web.path.page.PagePathHandler
public class PagePathHandler
Processes a .page dynamic page. Pages are xsl, with a few workarounds. They sit in the html/ directory and reference libraries from lib/xsl/ (the default root for xsl:includes). There are some custom directives, or TagProcessors including ServiceTagProcessor (for service manager calls) and ObjectTagProcessor (for objects return from query). Other tag processors can be added. See javadoc for specification. These custom processors graft the DOM result of custom processing onto the html DOM result tree. Also, there is a method to include freeform data in the returned stream via the <stream> tag.
The stream tag is of one of two formats <stream class="org.some.ClassName"
ServiceTagProcessor,
ObjectTagProcessor| Field Summary | |
|---|---|
static java.lang.String |
PAGE_TAG
|
static java.lang.String |
PARAM_PAGE_PATH
In QueryParams, the external path to the page without any loose parameters (ie project/browse.page, not html/project/browse/aproject/) |
static java.lang.String |
RHT_RENDER
render key for request handler thread |
static java.lang.String |
SESSION_ABSENT_URL
|
protected org.benow.xml.xsl.XSL |
xsl
|
| Fields inherited from class org.benow.web.path.FileBasedPathHandler |
|---|
base |
| Fields inherited from class org.benow.web.path.PathHandler |
|---|
CONTENT_LENGTH_UNKNOWN, LAST_MODIFIED_UNKNOWN, params, request, response |
| Constructor Summary | |
|---|---|
PagePathHandler()
|
|
| Method Summary | |
|---|---|
static void |
addEnv(org.w3c.dom.Document doc)
Adds the environment nodes to the root element of the given document. |
static void |
addEnv(org.w3c.dom.Document doc,
org.w3c.dom.Element e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
QueryParams params)
|
boolean |
canHandle(java.lang.String path)
ensure to call this method |
static boolean |
canRecordXML()
|
static org.w3c.dom.Document |
getXML(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
QueryParams params)
Override to provide xml for initial page rendering |
protected org.benow.xml.xsl.XSL |
getXSL(java.net.URL xslURL)
Creates an xsl transformer for the pathspec. |
protected java.lang.Object |
handle(java.io.PrintWriter w)
|
static boolean |
handlesFile(java.lang.String name)
|
protected java.lang.String |
marshallToXML(java.lang.Object result)
|
protected java.io.File |
onAbsentXSL(java.lang.String baseName)
Override to do something on absent xsl (like create it) |
void |
postProcessHTML(org.w3c.dom.Element htmlElem,
java.util.Map<java.lang.String,java.lang.Object> templateParams,
org.benow.xml.xsl.XSL source,
java.lang.String inputXML)
|
static void |
recordXML(java.lang.String url,
java.lang.String name,
java.lang.String xml2)
|
javax.xml.transform.stream.StreamSource |
resolve(java.lang.String href,
java.lang.String base)
Called during xsl transform to resolve <xsl:include> hrefs. |
protected void |
setXSL(java.lang.String path)
Call to set xsl manually, instead of via PagePathHandler.canHandle(String) |
protected void |
transform(org.w3c.dom.Document xmlDoc,
java.util.Map<java.lang.String,java.lang.Object> templateParams,
org.w3c.dom.Element contentE)
Transform the source xml onto the given output element using the given parameters. |
| Methods inherited from class org.benow.web.path.FileBasedPathHandler |
|---|
deliverFile, deliverResource |
| Methods inherited from class org.benow.web.path.PathHandler |
|---|
deliverHTML, deliverStream, deliverStream, deliverStream, handle, handle, handle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String RHT_RENDER
public static final java.lang.String SESSION_ABSENT_URL
public static final java.lang.String PAGE_TAG
public static final java.lang.String PARAM_PAGE_PATH
protected org.benow.xml.xsl.XSL xsl
| Constructor Detail |
|---|
public PagePathHandler()
| Method Detail |
|---|
public boolean canHandle(java.lang.String path)
throws WebException,
java.io.IOException
canHandle in class PathHandlerWebException
java.io.IOException
protected void setXSL(java.lang.String path)
throws WebException
path -
WebException
protected java.lang.Object handle(java.io.PrintWriter w)
throws java.io.IOException,
WebException
handle in class PathHandlerjava.io.IOException
WebException
protected void transform(org.w3c.dom.Document xmlDoc,
java.util.Map<java.lang.String,java.lang.Object> templateParams,
org.w3c.dom.Element contentE)
throws javax.xml.transform.TransformerException
xml - templateParams - contentE -
javax.xml.transform.TransformerExceptionpublic static boolean canRecordXML()
public static void recordXML(java.lang.String url,
java.lang.String name,
java.lang.String xml2)
public void postProcessHTML(org.w3c.dom.Element htmlElem,
java.util.Map<java.lang.String,java.lang.Object> templateParams,
org.benow.xml.xsl.XSL source,
java.lang.String inputXML)
throws java.lang.Throwable
htmlElem - result html elementtemplateParams - params used with xsl to generate including pagesource - xsl used to generate including pageinputXML - xml input to including page
java.lang.Throwable
public static org.w3c.dom.Document getXML(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
QueryParams params)
throws java.lang.Exception
request - response - params -
java.lang.Exceptionpublic static void addEnv(org.w3c.dom.Document doc)
doc -
public static void addEnv(org.w3c.dom.Document doc,
org.w3c.dom.Element e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
QueryParams params)
protected java.lang.String marshallToXML(java.lang.Object result)
throws java.io.IOException,
javax.xml.transform.TransformerException
java.io.IOException
javax.xml.transform.TransformerException
protected org.benow.xml.xsl.XSL getXSL(java.net.URL xslURL)
throws java.lang.Exception
baseName -
java.lang.Exception
WebExceptionprotected java.io.File onAbsentXSL(java.lang.String baseName)
baseName -
public javax.xml.transform.stream.StreamSource resolve(java.lang.String href,
java.lang.String base)
public static boolean handlesFile(java.lang.String name)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||