| java.lang.Object simpleorm.simplewebapp.context.WPageContext
All known Subclasses: simpleorm.simplewebapp.context.WPageContextServlet, simpleorm.simplewebapp.context.WPageContextTest,
WPageContext | abstract public class WPageContext (Code) | | Peer (one to one) with WPage, Provides all the interfacing between WPage and the server.
Attempts to unify the JSP Page context with the Servlet
doGet|Post parameters.
It is always created, even if there is no page context at all (eg. if during unit tests) in which
case its methods return dummy values.
PageContext is an ugly class because it is JSP specific, and cannot
be easily used from servlets.
However, its methods are many and have a nasty relationship to
Servlet ones.
For example, PageContext.getOut() returns a different, incompatible
class to HttpServelet.getWriter().
It is unclear what the relationship of other fields such as getAttribute
really are.
This class also provides an opportunity to mock out the web server entriely
and unit test just the WebBean.
Subtypes for JSP, Servlet, Test cases.
|
addContextToUrl | String addContextToUrl(String url)(Code) | | Adds context to localUrl if stars with a "/"
|
addParameterToUrl | public String addParameterToUrl(String url, String name, String value)(Code) | | returns url?name=value&name=value; encoding name and value.
Called after encodeContextUrl.
|
encodeContextUrl | public String encodeContextUrl(String url)(Code) | | Add context and session id to urls iff appropriate.
(Adds Web Context iff starts with "/", adds session IDs if cookieless sessions used.
|
getContextPath | String getContextPath()(Code) | | Web context, ie text after the host name. Overriden.
|
getParameter | abstract public String getParameter(String key)(Code) | | Ie. the get/post parameters to the webpage,
or artificial parameters to test cases.
|
getRefererUrl | public String getRefererUrl()(Code) | | Absolute URL of refering page to go back for CRUD etc.
|
getRemoteUser | public String getRemoteUser()(Code) | | Overriden -- Ie. the username of the current logged in user.
|
isUserInRole | public boolean isUserInRole(String role)(Code) | | Overrriden.
|
println | public void println(String msg)(Code) | | Dirty way to output to the JSP.
Note that the form is not in a good state to receive output in onProcess().
We keep the print variable hidden as it is inconsistent between JSP and Servlets.
|
redirect | public void redirect(String url)(Code) | | Overriden to Redirects to a new page, typically after a successful CRUD form.
|
|
|