|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts.action.Action
com.xpn.xwiki.web.XWikiAction
public abstract class XWikiAction
Root class for most XWiki actions. It provides a common framework that allows actions to execute just the specific action code, handling the extra activities, such as preparing the context and retrieving the document corresponding to the URL.
It defines two methods, action(XWikiContext)
and render(XWikiContext)
, that should be overridden by
specific actions. action(XWikiContext)
should contain the processing part of the action.
render(XWikiContext)
should return the name of a template that should be rendered, or manually write to the
response
stream.
Serving a request goes through the following phases:
XWiki-specific context
action(XWikiContext)
action(XWikiContext)
returns true, run the overridden render(XWikiContext)
render(XWikiContext)
returned a string (template name), render the template with that nameDuring this process, also handle specific errors, like when a document does not exist, or the user does not have the right to perform the current action.
Field Summary |
---|
Fields inherited from class org.apache.struts.action.Action |
---|
servlet |
Constructor Summary | |
---|---|
XWikiAction()
|
Method Summary | |
---|---|
boolean |
action(XWikiContext context)
|
protected void |
cleanupComponents()
|
protected boolean |
csrfTokenCheck(XWikiContext context)
Perform CSRF check and redirect to the resubmission page if needed. |
org.apache.struts.action.ActionForward |
execute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Handle server requests. |
org.apache.struts.action.ActionForward |
execute(XWikiContext context)
|
String |
getRealPath(String path)
|
protected XWikiDocument |
getTranslatedDocument(XWikiDocument doc,
String language,
XWikiContext context)
Gets the translated version of a document, in the specified language. |
protected void |
handleRevision(XWikiContext context)
|
protected void |
initializeContainerComponent(XWikiContext context)
|
protected XWikiContext |
initializeXWikiContext(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
|
String |
render(XWikiContext context)
|
protected boolean |
sendGlobalRedirect(XWikiResponse response,
String url,
XWikiContext context)
Send redirection based on a regexp pattern (if any) set at the main wiki level. |
protected void |
sendRedirect(XWikiResponse response,
String url)
|
Methods inherited from class org.apache.struts.action.Action |
---|
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XWikiAction()
Method Detail |
---|
public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws Exception
execute
in class org.apache.struts.action.Action
mapping
- The ActionMapping used to select this instanceform
- The optional ActionForm bean for this request (if any)req
- The HTTP request we are processingresp
- The HTTP response we are creating
IOException
- if an input/output error occurs
javax.servlet.ServletException
- if a servlet exception occurs
Exception
public org.apache.struts.action.ActionForward execute(XWikiContext context) throws Exception
Exception
protected XWikiContext initializeXWikiContext(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws XWikiException, javax.servlet.ServletException
XWikiException
javax.servlet.ServletException
protected void initializeContainerComponent(XWikiContext context) throws javax.servlet.ServletException
javax.servlet.ServletException
protected void cleanupComponents()
public String getRealPath(String path)
public boolean action(XWikiContext context) throws XWikiException
XWikiException
public String render(XWikiContext context) throws XWikiException
XWikiException
protected void handleRevision(XWikiContext context) throws XWikiException
XWikiException
protected boolean sendGlobalRedirect(XWikiResponse response, String url, XWikiContext context) throws Exception
response
- the servlet responseurl
- url of the requestcontext
- the XWiki context
Exception
protected void sendRedirect(XWikiResponse response, String url) throws XWikiException
XWikiException
protected XWikiDocument getTranslatedDocument(XWikiDocument doc, String language, XWikiContext context) throws XWikiException
doc
- the main (default, untranslated) document to translatelanguage
- the requested document languagecontext
- the current request context
XWikiException
- if the translation cannot be retrieved from the databaseprotected boolean csrfTokenCheck(XWikiContext context) throws XWikiException
context
- current xwiki context containing the request
XWikiException
- if the check fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |