use of org.apache.wiki.ui.PageCommand in project jspwiki by apache.
the class WikiContext method updateCommand.
/**
* Protected method that updates the internally cached Command.
* Will always be called when the page name, request context, or variable
* changes.
* @param requestContext the desired request context
* @since 2.4
*/
protected void updateCommand(String requestContext) {
if (requestContext == null) {
m_command = PageCommand.NONE;
} else {
CommandResolver resolver = m_engine.getCommandResolver();
m_command = resolver.findCommand(m_request, requestContext);
}
if (m_command instanceof PageCommand && m_page != null) {
m_command = m_command.targetedCommand(m_page);
}
}
use of org.apache.wiki.ui.PageCommand in project jspwiki by apache.
the class WikiContext method findCommand.
/**
* Looks up and returns a PageCommand based on a supplied WikiPage and HTTP
* request. First, the appropriate Command is obtained by examining the HTTP
* request; the default is {@link PageCommand#VIEW}. If the Command is a
* PageCommand (and it should be, in most cases), a targeted Command is
* created using the (non-<code>null</code>) WikiPage as target.
* @param engine the wiki engine
* @param request the HTTP request
* @param page the wiki page
* @return the correct command
*/
protected static Command findCommand(WikiEngine engine, HttpServletRequest request, WikiPage page) {
String defaultContext = PageCommand.VIEW.getRequestContext();
Command command = engine.getCommandResolver().findCommand(request, defaultContext);
if (command instanceof PageCommand && page != null) {
command = command.targetedCommand(page);
}
return command;
}
Aggregations