info.magnolia.cms.servlets
Class CommandBasedMVCServletHandler

java.lang.Object
  extended by info.magnolia.cms.servlets.MVCServletHandlerImpl
      extended by info.magnolia.cms.servlets.CommandBasedMVCServletHandler
All Implemented Interfaces:
MVCServletHandler
Direct Known Subclasses:
AdminTreeMVCHandler, PageMVCHandler

public abstract class CommandBasedMVCServletHandler
extends MVCServletHandlerImpl

This implementation tries first to get a command form it's command catalogue. If none is found it will call the execute method of the default MVCServletHandlerImpl, which tries to execute through reflection a related method.

Version:
$Revision: 41137 $ ($Author: gjoseph $)

Field Summary
 
Fields inherited from class info.magnolia.cms.servlets.MVCServletHandlerImpl
exception, request, response, VIEW_ERROR, VIEW_SUCCESS
 
Fields inherited from interface info.magnolia.cms.servlets.MVCServletHandler
VIEW_NOTHING
 
Constructor Summary
protected CommandBasedMVCServletHandler(String name, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 String execute(String commandName)
          Try to get the command from the catalog.
protected  org.apache.commons.chain.Command findCommand(String commandName)
          Used to get the command object.
 String getCatalogueName()
           
protected  Context getCommandContext(String commandName)
          The default implementation returns the current context.
protected  String getViewNameAfterExecution(String commandName, Context ctx)
          Default implementation returns the commandName itself.
 void setCatalogueName(String catalogueName)
           
 
Methods inherited from class info.magnolia.cms.servlets.MVCServletHandlerImpl
getCommand, getException, getExceptionStackTrace, getName, getRequest, getResponse, init, populateFromRequest, setCommand, setRequest, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.magnolia.cms.servlets.MVCServletHandler
renderHtml
 

Constructor Detail

CommandBasedMVCServletHandler

protected CommandBasedMVCServletHandler(String name,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
Parameters:
name -
request -
response -
Method Detail

execute

public String execute(String commandName)
Try to get the command from the catalog.

Specified by:
execute in interface MVCServletHandler
Overrides:
execute in class MVCServletHandlerImpl
Returns:
the name of the view to show (used in renderHtml)

getViewNameAfterExecution

protected String getViewNameAfterExecution(String commandName,
                                           Context ctx)
Default implementation returns the commandName itself.

Returns:
the view name returned by this execution

findCommand

protected org.apache.commons.chain.Command findCommand(String commandName)
Used to get the command object.

Returns:
the callable command object

getCommandContext

protected Context getCommandContext(String commandName)
The default implementation returns the current context.

Parameters:
commandName - the name of the command to be called
Returns:
the context to pass to the command

getCatalogueName

public String getCatalogueName()
Returns:
Returns the catalogueName.

setCatalogueName

public void setCatalogueName(String catalogueName)
Parameters:
catalogueName - The catalogueName to set.


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.