org.loom.action
Class AbstractAction

java.lang.Object
  extended by org.loom.action.AbstractAction
All Implemented Interfaces:
Action
Direct Known Subclasses:
AbstractActionImpl, CaptchaAction, LocaleAction, ResourcesAction

public abstract class AbstractAction
extends java.lang.Object
implements Action

Abstract superclass that provides some methods for the most common use.

Author:
icoloma

Constructor Summary
AbstractAction()
           
 
Method Summary
 void addError(Message message)
           
 Message addError(java.lang.String messageKey)
           
 Message addError(java.lang.String normalizedPropertyPath, java.lang.String messageKey)
           
protected  ForwardResolution forward()
          Forwards to a page name with the same name of the current event
protected  ForwardResolution forward(java.lang.String pageName)
          Forwards to the provided JSP page name.
protected  ForwardResolution forwardWithLocale(java.lang.String pageName)
           
 ActionContext getContext()
           
 MessagesRepository getMessagesRepository()
           
protected  java.lang.String getParam(java.lang.String propertyPath)
          Returns the value of the given property as a UrlParameter to be added to a Resolution
 LoomServletRequest getRequest()
           
 LoomServletResponse getResponse()
           
 boolean hasAnyError()
           
 boolean hasAnyError(java.lang.String propertyPath)
           
protected  RedirectResolution redirect(java.lang.Class<? extends Action> actionClass)
          Redirects to the provided action, default event
protected  RedirectResolution redirect(java.lang.Class<? extends Action> actionClass, java.lang.String event)
          Redirects to the provided action and event.
protected  RedirectResolution redirect(java.lang.String uri)
          Redirects to the provided url
protected  RedirectResolution redirect(java.lang.String action, java.lang.String event)
          Redirects to the provided action and event.
protected  PersistentFileResolution send(PersistentFile file)
          Send a file to the browser.
protected  StringResolution send(java.lang.String results)
          Return a simple text as the response.
 void setContext(ActionContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAction

public AbstractAction()
Method Detail

setContext

public void setContext(ActionContext context)
Specified by:
setContext in interface Action

getMessagesRepository

public MessagesRepository getMessagesRepository()

hasAnyError

public boolean hasAnyError()
Returns:
true if there is any validation/conversion error

hasAnyError

public boolean hasAnyError(java.lang.String propertyPath)
Parameters:
propertyPath - the property path to search error for
Returns:
true if there are validation/conversion errors associated to the provided property path

forward

protected ForwardResolution forward(java.lang.String pageName)
Forwards to the provided JSP page name.


forwardWithLocale

protected ForwardResolution forwardWithLocale(java.lang.String pageName)
See Also:
ResolutionFactory.forwardWithLocale(String)

forward

protected ForwardResolution forward()
Forwards to a page name with the same name of the current event


redirect

protected RedirectResolution redirect(java.lang.String uri)
Redirects to the provided url


redirect

protected RedirectResolution redirect(java.lang.Class<? extends Action> actionClass,
                                      java.lang.String event)
Redirects to the provided action and event.


redirect

protected RedirectResolution redirect(java.lang.Class<? extends Action> actionClass)
Redirects to the provided action, default event


redirect

protected RedirectResolution redirect(java.lang.String action,
                                      java.lang.String event)
Redirects to the provided action and event. The action parameter can be the short or full action name


send

protected PersistentFileResolution send(PersistentFile file)
Send a file to the browser.


send

protected StringResolution send(java.lang.String results)
Return a simple text as the response. The mime type will be set as text/plain by default.

Parameters:
results - the result to be handled to the browser as is.

getParam

protected java.lang.String getParam(java.lang.String propertyPath)
Returns the value of the given property as a UrlParameter to be added to a Resolution


getContext

public ActionContext getContext()
Specified by:
getContext in interface Action

getRequest

public LoomServletRequest getRequest()
Returns:
the request object that is being processed

getResponse

public LoomServletResponse getResponse()
Returns:
the response object that will be returned

addError

public Message addError(java.lang.String normalizedPropertyPath,
                        java.lang.String messageKey)

addError

public Message addError(java.lang.String messageKey)

addError

public void addError(Message message)


The Loom Framework 1.6-SNAPSHOT.
Licensed under the Apache License, Version 2.0 by Extrema Sistemas de Informacion S.L.