| java.lang.Object com.ecyrd.jspwiki.WikiContext
WikiContext | public class WikiContext implements Cloneable(Code) | | Provides state information throughout the processing of a page. A
WikiContext is born when the JSP pages that are the main entry
points, are invoked. The JSPWiki engine creates the new
WikiContext, which basically holds information about the page, the
handling engine, and in which context (view, edit, etc) the
call was done.
A WikiContext also provides request-specific variables, which can
be used to communicate between plugins on the same page, or
between different instances of the same plugin. A WikiContext
variable is valid until the processing of the page has ended. For
an example, please see the Counter plugin.
See Also: com.ecyrd.jspwiki.plugin.Counter author: Janne Jalkanen |
Constructor Summary | |
public | WikiContext(WikiEngine engine, WikiPage page) Create a new WikiContext for the given WikiPage.
Parameters: engine - The WikiEngine that is handling the request. Parameters: page - The WikiPage. |
CONFLICT | final public static String CONFLICT(Code) | | User has an internal conflict, and does quite not know what to
do. Please provide some counseling.
|
DIFF | final public static String DIFF(Code) | | User is viewing a DIFF between the two versions of the page.
|
EDIT | final public static String EDIT(Code) | | The EDIT context - the user is editing the page.
|
ERROR | final public static String ERROR(Code) | | An error has been encountered and the user needs to be informed.
|
INFO | final public static String INFO(Code) | | User is viewing page history.
|
LOGIN | final public static String LOGIN(Code) | | User is preparing for a login/authentication.
|
PREVIEW | final public static String PREVIEW(Code) | | User is previewing the changes he just made.
|
VIEW | final public static String VIEW(Code) | | The VIEW context - the user just wants to view the page
contents.
|
m_currentUser | UserProfile m_currentUser(Code) | | |
WikiContext | public WikiContext(WikiEngine engine, WikiPage page)(Code) | | Create a new WikiContext for the given WikiPage.
Parameters: engine - The WikiEngine that is handling the request. Parameters: page - The WikiPage. If you want to create aWikiContext for an older version of a page, you must use thisconstructor. |
clone | public Object clone()(Code) | | Returns a shallow clone of the WikiContext.
since: 2.1.37. |
getCurrentUser | public UserProfile getCurrentUser()(Code) | | Gets the current user. May return null, in case the current
user has not yet been determined; or this is an internal system.
|
getHttpParameter | public String getHttpParameter(String paramName)(Code) | | This method will safely return any HTTP parameters that
might have been defined. You should use this method instead
of peeking directly into the result of getHttpRequest(), since
this method is smart enough to do all of the right things,
figure out UTF-8 encoded parameters, etc.
since: 2.0.13. Parameters: paramName - Parameter name to look for. HTTP parameter, or null, if no such parameter existed. |
getHttpRequest | public HttpServletRequest getHttpRequest()(Code) | | If the request did originate from a HTTP request,
then the HTTP request can be fetched here. However, it the request
did NOT originate from a HTTP request, then this method will
return null, and YOU SHOULD CHECK FOR IT!
Null, if no HTTP request was done. since: 2.0.13. |
getNamespace | public String getNamespace()(Code) | | Gets the wiki instance namespace for this wiki context.
The wiki instance namespace. |
getPage | public WikiPage getPage()(Code) | | Returns the page that is being handled.
|
getPrivateSessionAttribute | public Object getPrivateSessionAttribute(String key)(Code) | | Gets a previously set private session attribute.
Private attributes are visible to the current wiki context only.
Parameters: key - The attribute name. The attribute value. |
getRequestContext | public String getRequestContext()(Code) | | Returns the request context.
|
getTemplate | public String getTemplate()(Code) | | Gets the template that is to be used throughout this request.
since: 2.1.15. |
getTemplateBundle | public ResourceBundle getTemplateBundle()(Code) | | Gets the template resourece bundle that is to be used throughout this request.
|
getVariable | public Object getVariable(String key)(Code) | | Gets a previously set variable.
Parameters: key - The variable name. The variable contents. |
setCurrentUser | public void setCurrentUser(UserProfile wup)(Code) | | Sets the current user.
|
setHttpRequest | public void setHttpRequest(HttpServletRequest req)(Code) | | If the request originated from a HTTP server,
the HTTP request is stored here.
Parameters: req - The HTTP servlet request. since: 2.0.13. |
setNamespace | public void setNamespace(String namespace)(Code) | | Sets an optional wiki instance namespace for this wiki context.
The data is discarded once the context is finished.
Parameters: namespace - The namespace. |
setPage | public void setPage(WikiPage page)(Code) | | Sets the page that is being handled.
since: 2.1.37. |
setPrivateSessionAttribute | public void setPrivateSessionAttribute(String key, Object data)(Code) | | Sets a private session attribute.
Private attributes are visible to the current wiki context only.
The attribute is valid while the HttpSession is valid,
The attribute data is discarded once the session is finished.
Parameters: key - The attribute name. Parameters: data - The attribute value. |
setRequestContext | public void setRequestContext(String arg)(Code) | | Sets the request context. See above for the different
request contexts (VIEW, EDIT, etc.)
Parameters: arg - The request context (one of the predefined contexts.) |
setTemplate | public void setTemplate(String dir)(Code) | | Sets the template to be used for this request.
since: 2.1.15. |
setTemplateBundle | public void setTemplateBundle(ResourceBundle rb)(Code) | | Sets the template resourece bundle that is to be used throughout this request.
|
setVariable | public void setVariable(String key, Object data)(Code) | | Sets a variable. The variable is valid while the WikiContext is valid,
i.e. while page processing continues. The variable data is discarded
once the page processing is finished.
Parameters: key - The variable name. Parameters: data - The variable value. |
translate | public String translate(String key)(Code) | | Translates key using the current template's resourece bundle.
|
|
|