| java.lang.Object simpleorm.simplehtml.HSuperRequestlet
All known Subclasses: simpleorm.simplehtml.HTestRequestlet,
HSuperRequestlet | abstract public class HSuperRequestlet (Code) | | Common Super class for Servlet Requestlet Invocations.
A servlet's doGet|Post method creates an instance of a
subclass of this class (DDriverRequestlet) that processes the request.
So there is one instance per request, not shared, so can have state.
Provides handy methods for output etc.
Ie. A Requestlet is like a Servlet but there is one instance per request, which is important.
Normally these are dispatched by the HMasterServlet based on the URI.
$Id: HSuperRequestlet.java,v 1.8 2006/04/03 08:53:23 aberglas Exp $
See Also: DDriverRequest See Also: which extends this class for the Driver project author: aberglas |
Method Summary | |
abstract protected void | doBody() Override this to add the bulk of the body code in normal requestlets. | protected void | doBodyTag() Output the actual BODY tag, can be used to add javascript triggers. | public void | doGetPost() Called for gets and posts, as set up from initRequestlet. | protected void | doHead() Outputs HTML Header, title etc. | protected void | doInitialize() Called before any html is output, can initialize application data structures. | protected void | doPostBody() output html after the Body. | protected void | doPreBody() output html before the Body. | protected void | doSubmit() Override to add validation and business logic. | abstract public String | getContext() The web context, ie.
The part of the Url between the port and the ap. | public PrintWriter | getOut() | public HttpServletRequest | getRequest() | public HttpServletResponse | getResponse() | public HttpServlet | getServlet() | public String | getShortTitle() (Consitent) Short name to appear in menus, links etc. | abstract public String | getTitle() Full title that appers in , , site map etc. | public String | initParamattr(String name, String value) Initialize paramattr to value iff it has no value. | public HSuperRequestlet | initRequestlet(HttpServlet servlet, HttpServletRequest request, HttpServletResponse response, boolean isGet) Initializes the requestlet with information about the servlet and call. | public String | localUrl(String name) url of local resources such as images and style sheets. | public void | outEscaped(String data) | public void | outEscaped(String data, boolean nbsp) | public void | outHtml(String html) Outputs raw HTML, does NOT quote it. | public void | outURLEncoded(String data) URL Encodes string in appropriate? encoding. | public String | paramattr(String name, String defalt) returns request.getAttribute or request.getParameter if attribute not set. | public String | paramattr(String name) | public boolean | paramattrEmpty(String name) | public void | register() Register the class in the DRegistry. | public HSuperRequestlet | registeredInstance(Class clazz) Returns the registered dummy instance of the requestlet. | public String | requestletUrl(Class clazz) Returns the Url of the requestlet class passed. | public void | setParamattr(String name, String value) | public String | thisUrl() URL of this requestlet. |
registry | static LinkedHashMap<String, HSuperRequestlet> registry(Code) | | Registry of all Requestlets that can be dispatched by the HMasterServlet.
Need to call each requestlets .register() method in a main() in order to
put it in this table.
Used by HMasterServlet to dispatch calls.
|
doBody | abstract protected void doBody() throws Exception(Code) | | Override this to add the bulk of the body code in normal requestlets.
|
doBodyTag | protected void doBodyTag() throws Exception(Code) | | Output the actual BODY tag, can be used to add javascript triggers.
|
doGetPost | public void doGetPost()(Code) | | Called for gets and posts, as set up from initRequestlet.
Forms structure of a request: response, header, body, trailer...
Traps exceptions and displays them.
|
doHead | protected void doHead() throws Exception(Code) | | Outputs HTML Header, title etc.
|
doInitialize | protected void doInitialize() throws Exception(Code) | | Called before any html is output, can initialize application data structures.
|
doPostBody | protected void doPostBody() throws Exception(Code) | | output html after the Body. ie. footers.
Normally overriden
|
doPreBody | protected void doPreBody() throws Exception(Code) | | output html before the Body. Eg. Menubars.
Normally overriden.
|
doSubmit | protected void doSubmit() throws Exception(Code) | | Override to add validation and business logic.
Usually calls bw.addFieldError etc.
Only called if an "f.Submit" field is present.
Called at very beginning, before any html is output, so can redirect.
However, cannot produce any HTML output as there is no header yet.
Can add error messages.
|
getContext | abstract public String getContext()(Code) | | The web context, ie.
The part of the Url between the port and the ap. No outer "/"s.
|
getShortTitle | public String getShortTitle()(Code) | | (Consitent) Short name to appear in menus, links etc.
Normally overriden.
|
getTitle | abstract public String getTitle()(Code) | | Full title that appers in , , site map etc.
|
initParamattr | public String initParamattr(String name, String value)(Code) | | Initialize paramattr to value iff it has no value.
Returns the resulting value of the paramattr.
|
localUrl | public String localUrl(String name)(Code) | | url of local resources such as images and style sheets.
Strips of "Requestlet" if present, adds .rq.
|
outEscaped | public void outEscaped(String data)(Code) | | outEscaped(data, false)
|
outEscaped | public void outEscaped(String data, boolean nbsp)(Code) | | Outputs data after escaping it so that '<' becomes '<' etc.
Converts spaces to ' ' iff nbsp
Amazing that I need to write this myself!
See Also: HSuperRequestlet.outHtml |
outURLEncoded | public void outURLEncoded(String data) throws Exception(Code) | | URL Encodes string in appropriate? encoding.
used for ?=value Get parameters on links
|
paramattr | public String paramattr(String name, String defalt)(Code) | | returns request.getAttribute or request.getParameter if attribute not set.
So a paramattrs is a settable parameter.
Prefix names to avoid conflicts in Attributes, for forms fields just f.field should do.
The nullObject is used to set nulls instead of null because null attributes are simply removed by servlets.
Conversion to nulls is automatic.
|
paramattrEmpty | public boolean paramattrEmpty(String name)(Code) | | paramattr == null or ""
|
register | public void register()(Code) | | Register the class in the DRegistry. Needs a dummy instance.
|
registeredInstance | public HSuperRequestlet registeredInstance(Class clazz)(Code) | | Returns the registered dummy instance of the requestlet.
|
requestletUrl | public String requestletUrl(Class clazz)(Code) | | Returns the Url of the requestlet class passed.
Used for generating anchor href=
|
thisUrl | public String thisUrl()(Code) | | URL of this requestlet. Used to generate links to this.
(Could cache the result and save some garbage.)
|
|
|