org.loom.resolution
Class DefaultResolutionFactory

java.lang.Object
  extended by org.loom.resolution.DefaultResolutionFactory
All Implemented Interfaces:
ResolutionFactory

@Singleton
public class DefaultResolutionFactory
extends java.lang.Object
implements ResolutionFactory

Default ResolutionFactory implementation


Constructor Summary
DefaultResolutionFactory()
           
 
Method Summary
 ForwardResolution forward(java.lang.String pageName)
          Create a ForwardResolution
 ForwardResolution forwardWithLocale(java.lang.String pageName)
          Forward to a page, with preference for a localized page if possible.
 java.lang.String getForwardResourcesRoot()
           
 org.codehaus.jackson.map.ObjectMapper getMapper()
           
 JacksonResolution json(java.lang.Object contents)
          Sends a JSON serialization of the contents object.
 RedirectResolution redirect(java.lang.Class<? extends Action> actionClass, java.lang.String event)
          Redirects the browser to a different Action and Event
 RedirectResolution redirect(java.lang.String url)
          Redirects the browser to a different URL
 RedirectResolution redirect(java.lang.String action, java.lang.String event)
          Redirects the browser to a different Action and Event
 PersistentFileResolution send(PersistentFile file)
          Sends a persistent file to the browser.
 void setForwardResourcesRoot(java.lang.String forwardResourcesRoot)
           
 void setMapper(org.codehaus.jackson.map.ObjectMapper mapper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResolutionFactory

public DefaultResolutionFactory()
Method Detail

forward

public ForwardResolution forward(java.lang.String pageName)
Description copied from interface: ResolutionFactory
Create a ForwardResolution

Specified by:
forward in interface ResolutionFactory
Parameters:
pageName - the name of the forward destination
Returns:
a ForwardResolution to the provided resource

forwardWithLocale

public ForwardResolution forwardWithLocale(java.lang.String pageName)
Description copied from interface: ResolutionFactory
Forward to a page, with preference for a localized page if possible. A forward to "myfile.jsp" with spanish request locale and english default locale will first try "myfile_es.jsp", then "myfile_en.jsp" and, if none is found, "myfile.jsp"

Specified by:
forwardWithLocale in interface ResolutionFactory
Parameters:
pageName - the name of the resource to forward to
Returns:
a ForwardResolution to the provided page
See Also:
LocaleForwardResolution

send

public PersistentFileResolution send(PersistentFile file)
Description copied from interface: ResolutionFactory
Sends a persistent file to the browser.

Specified by:
send in interface ResolutionFactory

redirect

public RedirectResolution redirect(java.lang.String url)
Description copied from interface: ResolutionFactory
Redirects the browser to a different URL

Specified by:
redirect in interface ResolutionFactory
Parameters:
url - the url for the browser redirection
Returns:
a RedirectResolution pointing to the provided URL

redirect

public RedirectResolution redirect(java.lang.String action,
                                   java.lang.String event)
Description copied from interface: ResolutionFactory
Redirects the browser to a different Action and Event

Specified by:
redirect in interface ResolutionFactory
Parameters:
action - the action short or long name
event - the event to be invoked, null for default event
Returns:
a RedirectResolution pointing to the provided URL

redirect

public RedirectResolution redirect(java.lang.Class<? extends Action> actionClass,
                                   java.lang.String event)
Description copied from interface: ResolutionFactory
Redirects the browser to a different Action and Event

Specified by:
redirect in interface ResolutionFactory
Parameters:
actionClass - the action class
event - the event to be called, null for default event
Returns:
a RedirectResolution pointing to the provided URL

getForwardResourcesRoot

public java.lang.String getForwardResourcesRoot()

setForwardResourcesRoot

public void setForwardResourcesRoot(java.lang.String forwardResourcesRoot)

json

public JacksonResolution json(java.lang.Object contents)
Description copied from interface: ResolutionFactory
Sends a JSON serialization of the contents object.

Specified by:
json in interface ResolutionFactory
Parameters:
contents - the contents object to serialize as a JSON object
Returns:
the JSON resolution

getMapper

public org.codehaus.jackson.map.ObjectMapper getMapper()

setMapper

public void setMapper(org.codehaus.jackson.map.ObjectMapper mapper)