org.codehaus.waffle.servlet
Class WaffleServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.codehaus.waffle.servlet.WaffleServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
WaffleXMLServlet

public class WaffleServlet
extends javax.servlet.http.HttpServlet

Waffle's FrontController for handling user requests.

Author:
Michael Ward, Mauro Talevi
See Also:
Serialized Form

Constructor Summary
WaffleServlet()
          Default constructor used by servlet container
WaffleServlet(ActionMethodExecutor actionMethodExecutor, ActionMethodResponseHandler actionMethodResponseHandler, ServletMonitor servletMonitor, ControllerDataBinder controllerDataBinder, ControllerDefinitionFactory controllerDefinitionFactory, MessageResources messageResources, ViewDataBinder viewDataBinder, ViewResolver viewResolver, Validator validator)
          Constructor required by builder and useful for testing
 
Method Summary
protected  View buildActionMethodFailureView(ControllerDefinition controllerDefinition)
          Builds the view for action method failures, by default the referring view.
protected  View buildErrorsView()
          Builds the errors view, for cases in which the context container or the controller are not found.
protected  View buildRedirectingView(javax.servlet.http.HttpServletRequest request, ControllerDefinition controllerDefinition)
          Build redirecting view, used by PRG paradigm.
protected  View buildView(ControllerDefinition controllerDefinition)
          Build a view back to the referring page, using the Controller's name as the View name.
protected  void configureViewProperties()
           
 void init()
           
protected  void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Responsible for servicing the requests from the users.
 java.lang.String toString()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WaffleServlet

public WaffleServlet()
Default constructor used by servlet container


WaffleServlet

public WaffleServlet(ActionMethodExecutor actionMethodExecutor,
                     ActionMethodResponseHandler actionMethodResponseHandler,
                     ServletMonitor servletMonitor,
                     ControllerDataBinder controllerDataBinder,
                     ControllerDefinitionFactory controllerDefinitionFactory,
                     MessageResources messageResources,
                     ViewDataBinder viewDataBinder,
                     ViewResolver viewResolver,
                     Validator validator)
Constructor required by builder and useful for testing

Parameters:
actionMethodExecutor -
actionMethodResponseHandler -
servletMonitor -
controllerDataBinder -
controllerDefinitionFactory -
messageResources -
viewDataBinder -
viewResolver -
validator -
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

configureViewProperties

protected void configureViewProperties()

service

protected void service(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException
Responsible for servicing the requests from the users.

Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
request - the HttpServletResponse
response - the HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

buildView

protected View buildView(ControllerDefinition controllerDefinition)
Build a view back to the referring page, using the Controller's name as the View name.

Parameters:
controllerDefinition - the ControllerDefinition
Returns:
The View

buildRedirectingView

protected View buildRedirectingView(javax.servlet.http.HttpServletRequest request,
                                    ControllerDefinition controllerDefinition)
Build redirecting view, used by PRG paradigm.

Parameters:
request - the request
controllerDefinition - the ControllerDefinition
Returns:
The RedirectView

buildActionMethodFailureView

protected View buildActionMethodFailureView(ControllerDefinition controllerDefinition)
                                     throws javax.servlet.ServletException
Builds the view for action method failures, by default the referring view. The user can extend and override behaviour, eg to throw a ServletException.

Parameters:
controllerDefinition - the ControllerDefinition
Returns:
The referring View
Throws:
javax.servlet.ServletException - if required

buildErrorsView

protected View buildErrorsView()
                        throws javax.servlet.ServletException
Builds the errors view, for cases in which the context container or the controller are not found. The user can extend and override behaviour, eg to throw a ServletException.

Returns:
The referring View
Throws:
javax.servlet.ServletException - if required

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008. All Rights Reserved.