org.loom.resolution
Class DefaultForwardResolution

java.lang.Object
  extended by org.loom.resolution.AbstractHttpResolution
      extended by org.loom.resolution.DefaultForwardResolution
All Implemented Interfaces:
CacheableResolution, ForwardResolution, HttpResolution, Resolution
Direct Known Subclasses:
LocaleForwardResolution

public class DefaultForwardResolution
extends AbstractHttpResolution
implements ForwardResolution

Forward a request. Forwarded resources are located by default inside /WEB-INF/jsp to prevent direct browser access.


Constructor Summary
DefaultForwardResolution()
           
 
Method Summary
 ForwardResolution addCookie(javax.servlet.http.Cookie cookie)
          Adds a cookie
 ForwardResolution addCookie(java.lang.String name, java.lang.String value)
          Adds a cookie that will not be stored on disk (will be deleted when the browser is closed).
 ForwardResolution addCookie(java.lang.String name, java.lang.String value, int maxAge)
          Adds a cookie
 ForwardResolution addHeader(java.lang.String name, java.lang.Object value)
          Add a http header.
 java.lang.String calculateTargetResource(LoomServletRequest request)
           
 java.lang.String getDestination()
           
 java.lang.String getForwardResourcesRoot()
           
 void resolve(LoomServletRequest request, LoomServletResponse response)
          Write the response contents
 ForwardResolution set(java.lang.String name, java.lang.Object value)
          Set a request-scoped attribute.
 ForwardResolution setAttribute(java.lang.String name, java.lang.Object value)
          Set a request-scoped attribute.
 ForwardResolution setCacheControl(CacheControl cacheControl)
          Sets the cache data to be sent to the browser
 ForwardResolution setCharset(java.lang.String charset)
          Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.
 ForwardResolution setContentType(java.lang.String contentType)
          Sets the content type of the response being sent to the client, if the response has not been committed yet.
 void setDestination(java.lang.String resource)
           
 void setForwardResourcesRoot(java.lang.String forwardResourcesRoot)
           
 ForwardResolution setHeader(java.lang.String name, java.lang.Object value)
          Set a String http header.
 ForwardResolution setHeaderIfNotPresent(java.lang.String name, java.lang.Object value)
          Set a String http header if it has not been set.
 java.lang.String toString()
           
 
Methods inherited from class org.loom.resolution.AbstractHttpResolution
addDateHeader, addIntHeader, containsHeader, getCacheControl, getCharset, getContentType, setDateHeader, setDateHeaderIfNotPresent, setIntHeader, setIntHeaderIfNotPresent, setJsonHeader, writeHeaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultForwardResolution

public DefaultForwardResolution()
Method Detail

resolve

public void resolve(LoomServletRequest request,
                    LoomServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Description copied from interface: Resolution
Write the response contents

Specified by:
resolve in interface Resolution
Specified by:
resolve in class AbstractHttpResolution
Parameters:
request - the current request object
response - the current response object
Throws:
java.io.IOException
javax.servlet.ServletException

calculateTargetResource

public java.lang.String calculateTargetResource(LoomServletRequest request)

getDestination

public java.lang.String getDestination()

setDestination

public void setDestination(java.lang.String resource)

toString

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

getForwardResourcesRoot

public java.lang.String getForwardResourcesRoot()

setForwardResourcesRoot

public void setForwardResourcesRoot(java.lang.String forwardResourcesRoot)

set

public ForwardResolution set(java.lang.String name,
                             java.lang.Object value)
Description copied from interface: ForwardResolution
Set a request-scoped attribute. This method is equivalent to invoking request.setAttribute(name, value)

Specified by:
set in interface ForwardResolution
Parameters:
name - the name of the attribute to set
value - the value of the attribute
Returns:
this same resolution instance

setAttribute

public ForwardResolution setAttribute(java.lang.String name,
                                      java.lang.Object value)
Description copied from interface: ForwardResolution
Set a request-scoped attribute. This method is equivalent to invoking request.setAttribute(name, value)

Specified by:
setAttribute in interface ForwardResolution
Parameters:
name - the name of the attribute to set
value - the value of the attribute
Returns:
this same resolution instance

addCookie

public ForwardResolution addCookie(java.lang.String name,
                                   java.lang.String value)
Description copied from interface: HttpResolution
Adds a cookie that will not be stored on disk (will be deleted when the browser is closed).

Specified by:
addCookie in interface ForwardResolution
Specified by:
addCookie in interface HttpResolution
Overrides:
addCookie in class AbstractHttpResolution
Parameters:
name - the name of the cookie
value - the value of the Cookie

addCookie

public ForwardResolution addCookie(java.lang.String name,
                                   java.lang.String value,
                                   int maxAge)
Description copied from interface: HttpResolution
Adds a cookie

Specified by:
addCookie in interface ForwardResolution
Specified by:
addCookie in interface HttpResolution
Overrides:
addCookie in class AbstractHttpResolution
Parameters:
name - the name of the cookie
value - the value of the Cookie
maxAge - can be positive (number of seconds that it will be stored in the browser), zero (to delete the cookie from the browser) or a negative value (to indicate that the cookie should not be stored in disk and will be forgotten when the browser exists).

addCookie

public ForwardResolution addCookie(javax.servlet.http.Cookie cookie)
Description copied from interface: HttpResolution
Adds a cookie

Specified by:
addCookie in interface ForwardResolution
Specified by:
addCookie in interface HttpResolution
Overrides:
addCookie in class AbstractHttpResolution
Parameters:
cookie - the cookie to be added to the response

addHeader

public ForwardResolution addHeader(java.lang.String name,
                                   java.lang.Object value)
Description copied from interface: HttpResolution
Add a http header. If the header already exists a new value will be added.

Specified by:
addHeader in interface ForwardResolution
Specified by:
addHeader in interface HttpResolution
Overrides:
addHeader in class AbstractHttpResolution
Parameters:
name - the name of the http header
value - the value of the http header. Date, int and String are supported. Anything else will be cast to toString(). Null will be ignored.

setHeader

public ForwardResolution setHeader(java.lang.String name,
                                   java.lang.Object value)
Description copied from interface: HttpResolution
Set a String http header. If the header already exists it will be replaced.

Specified by:
setHeader in interface ForwardResolution
Specified by:
setHeader in interface HttpResolution
Overrides:
setHeader in class AbstractHttpResolution
Parameters:
name - the name of the http header
value - the value of the http header

setHeaderIfNotPresent

public ForwardResolution setHeaderIfNotPresent(java.lang.String name,
                                               java.lang.Object value)
Description copied from interface: HttpResolution
Set a String http header if it has not been set.

Specified by:
setHeaderIfNotPresent in interface ForwardResolution
Specified by:
setHeaderIfNotPresent in interface HttpResolution
Overrides:
setHeaderIfNotPresent in class AbstractHttpResolution
Parameters:
name - the name of the http header
value - the value of the http header

setCharset

public ForwardResolution setCharset(java.lang.String charset)
Description copied from interface: HttpResolution
Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.

Specified by:
setCharset in interface ForwardResolution
Specified by:
setCharset in interface HttpResolution
Overrides:
setCharset in class AbstractHttpResolution

setContentType

public ForwardResolution setContentType(java.lang.String contentType)
Description copied from interface: HttpResolution
Sets the content type of the response being sent to the client, if the response has not been committed yet. The given content type may include a character encoding specification, for example, text/html;charset=UTF-8. Notice that #setCharset(String) can also be used for this.

Specified by:
setContentType in interface ForwardResolution
Specified by:
setContentType in interface HttpResolution
Overrides:
setContentType in class AbstractHttpResolution

setCacheControl

public ForwardResolution setCacheControl(CacheControl cacheControl)
Description copied from interface: CacheableResolution
Sets the cache data to be sent to the browser

Specified by:
setCacheControl in interface CacheableResolution
Specified by:
setCacheControl in interface ForwardResolution
Specified by:
setCacheControl in interface HttpResolution
Overrides:
setCacheControl in class AbstractHttpResolution
Parameters:
cacheControl - the cache data.
Returns:
this same instance, to allow easy chaining of invocations