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

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: 32667 $ ($Author: gjoseph $)
Author:
Philipp Bracher

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(java.lang.String name, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 java.lang.String execute(java.lang.String commandName)
          Try to get the command from the catalogue
protected  org.apache.commons.chain.Command findCommand(java.lang.String commandName)
          Used to get the command object
 java.lang.String getCatalogueName()
           
protected  Context getCommandContext(java.lang.String commandName)
          The default implementation returns the current context
protected  java.lang.String getViewNameAfterExecution(java.lang.String commandName, Context ctx)
          Default implemenation returns the commandName itself
 void setCatalogueName(java.lang.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(java.lang.String name,
                                        javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
Parameters:
name -
request -
response -
Method Detail

execute

public java.lang.String execute(java.lang.String commandName)
Try to get the command from the catalogue

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

getViewNameAfterExecution

protected java.lang.String getViewNameAfterExecution(java.lang.String commandName,
                                                     Context ctx)
Default implemenation returns the commandName itself

Parameters:
commandName -
ctx -
Returns:
the view name returned by this execution

findCommand

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

Parameters:
commandName -
Returns:
the callable command object

getCommandContext

protected Context getCommandContext(java.lang.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 java.lang.String getCatalogueName()
Returns:
Returns the catalogueName.

setCatalogueName

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


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