|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.ui.util.PageProcessor
The base class for objects that perform HttpRequest processing and generate HTML responses. Instances of these classes are typically instantiated by a JSP, and then allowed to process the request. The JSP typically does a small amount of customization like setting titles and navigation options.
The end result is not unlike writing a servlet, but using JSP launchers means you don't have to register servlets, and allow some amount of customiztion.
You should assume that you are already within an page generated by a higher level processor, usually a JSP. So "page" processor may be a bit of a misnomer, since the generated HTML is destined for a compartment within the page, it isn't the entire page.
Field Summary | |
protected java.lang.String |
_command
The value of the "command" parameter extracted from the post data or URL query string. |
protected boolean |
_trace
Debug flag |
protected static Trace |
trace
|
Constructor Summary | |
PageProcessor()
|
Method Summary | |
void |
addComment(java.lang.String msg)
Add a comment to the list. |
void |
addComments(java.util.List msgs)
Add a list of comments. |
void |
addError(java.lang.Object msg)
Add an error message to the list. |
void |
addErrors(java.util.List msgs)
Add a list of errors. |
void |
addMessage(java.lang.Object msg)
Add an informational message to the list. |
void |
addMessages(java.util.List msgs)
Add a list of messages. |
void |
clearErrors()
Clear the error message list. |
void |
clearMessages()
Clear the informational message list. |
com.waveset.ui.util.html.HtmlPage |
generate()
Generate the page as an HtmlPage object. |
java.lang.String |
generateHTML()
Generate the page as HTML text. |
java.lang.String |
generateHTML(com.waveset.ui.util.html.Component root)
Generate the HTML for a component, normally an HtmlPage. |
java.lang.String |
generateHTML(java.lang.Throwable t)
If an exception is caught during HTML generation, render the text of the exception. |
java.lang.String |
getAppBaseURL()
gets application base url to specify which application we are currently running under. |
java.lang.String |
getCancelURL()
|
java.lang.String |
getCommand()
|
java.util.List |
getComments()
|
java.util.List |
getErrors()
|
java.lang.String |
getHtmlFormName()
Bug #13751 Return the String name of the HTML form as rendered by HtmlPage. |
java.util.List |
getMessages()
|
java.lang.String |
getNextURL()
|
static ObjectRef |
getObjectRef(java.util.Map map,
java.lang.String key,
Type type)
|
java.lang.String |
getParameter(java.lang.String name)
Get an HttpRequest parameter. |
java.lang.String |
getPostURL()
|
RequestState |
getRequestState()
|
java.lang.String |
getSubTitle()
|
java.lang.String |
getTitle()
|
boolean |
isCommand(java.lang.String cmd)
Tests a command string. |
boolean |
isErrors()
Return true if there are any error messages. |
protected static void |
println(java.lang.Object o)
Ubiquitous "macro" |
java.lang.String |
process(RequestState state)
Page processing method. |
void |
setAppBaseURL(java.lang.String appBase)
Sets the application base url string to be used in hard-coded relative urls for new applications such as auditor. |
void |
setCancelURL(java.lang.String url)
Set the URL that we will POST to when the generated form is canceled. |
void |
setCommand(java.lang.String cmd)
Change the command. |
void |
setHiddenId(java.lang.String id)
|
void |
setHtmlFormName(java.lang.String n)
Bug #13751 Set the name of the HTML FORM tag when it is rendered by HtmlPage. |
void |
setNextURL(java.lang.String url)
|
void |
setPostURL(java.lang.String url)
Set the URL that we will normally POST to when the generated form is submitted. |
protected void |
setRequestState(RequestState state)
|
void |
setSubTitle(java.lang.String subTitle)
|
void |
setTitle(java.lang.String title)
|
void |
setTrace(boolean b)
|
static java.lang.String |
stripDirectory(java.lang.String src)
Kludge to strip the directory prefix from a post URL. |
void |
transferPageState(com.waveset.ui.util.html.HtmlPage page)
The com.waveset.ui.util.html.HtmlPage classes need some of the same information that was given to the PageProcessor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static Trace trace
protected java.lang.String _command
protected boolean _trace
Constructor Detail |
public PageProcessor()
Method Detail |
public void setTrace(boolean b)
public void setTitle(java.lang.String title)
public void setSubTitle(java.lang.String subTitle)
public void setPostURL(java.lang.String url)
public void setCancelURL(java.lang.String url)
public void setNextURL(java.lang.String url)
public void setHiddenId(java.lang.String id)
public void setCommand(java.lang.String cmd)
public void setAppBaseURL(java.lang.String appBase)
appBase
- public void setHtmlFormName(java.lang.String n)
public void clearErrors()
public void addError(java.lang.Object msg)
public void addErrors(java.util.List msgs)
public boolean isErrors()
public void clearMessages()
public void addMessage(java.lang.Object msg)
public void addMessages(java.util.List msgs)
public void addComment(java.lang.String msg)
public void addComments(java.util.List msgs)
public java.lang.String getTitle()
public java.lang.String getSubTitle()
public java.lang.String getPostURL()
public java.lang.String getCancelURL()
public java.lang.String getNextURL()
public java.lang.String getAppBaseURL()
public java.util.List getErrors()
public java.util.List getMessages()
public java.util.List getComments()
public RequestState getRequestState()
protected void setRequestState(RequestState state)
public java.lang.String getCommand()
public java.lang.String getHtmlFormName()
public boolean isCommand(java.lang.String cmd)
public java.lang.String process(RequestState state) throws WavesetException
The JSP is expected to call this first after setting any customization options.
The method may return a string, which is treated as a URL fragment for the next page. The JSP is expected to obey this. If the return string is null, the JSP is expected to call the either the generate() or generateHTML() method, and emit the HTML result.
You normally want to overload this but for very simple forms, we just save state and fall in to generate().
WavesetException
public com.waveset.ui.util.html.HtmlPage generate() throws WavesetException
The JSP is expected to call this after calling process(), but only if process() returns a null URL.
There are two variants of this, one that returns an HtmlPage object, and the other a completely rendered string of HTML. You would use generate() if the JSP needed to inspect or modify the HtmlPage object before the HTML was generated. If you have no processing to do, use generateHTML.
WavesetException
public java.lang.String generateHTML(com.waveset.ui.util.html.Component root)
public java.lang.String generateHTML(java.lang.Throwable t)
public java.lang.String generateHTML()
The default implementation is just to call generate() and format the result.
public java.lang.String getParameter(java.lang.String name)
public void transferPageState(com.waveset.ui.util.html.HtmlPage page)
NOTE: We always pass along URLs, but we will not trash the title or subtitle if the page already has one. Titles are better specified in the Form, while URLs are better set by the JSP.
protected static void println(java.lang.Object o)
public static java.lang.String stripDirectory(java.lang.String src)
This is necessary because we want to redirect back to a URL that was specified as the "post URL in the JSP. Post URLs have a directory prefix because it will be embedded in
public static ObjectRef getObjectRef(java.util.Map map, java.lang.String key, Type type)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |