org.loom.resolution
Interface HttpResolution

All Superinterfaces:
CacheableResolution, Resolution
All Known Subinterfaces:
ForwardResolution, RedirectResolution
All Known Implementing Classes:
AbstractFileResolution, AbstractHttpResolution, AutocompleteResolution, BufferedImageResolution, DefaultForwardResolution, HtmlResolution, HttpErrorResolution, InputStreamResolution, JacksonResolution, JsonResolution, LocaleForwardResolution, PersistentFileResolution, RedirectResolutionImpl, StringResolution, ZipFileResolution

public interface HttpResolution
extends CacheableResolution

A response object with http headers.


Method Summary
 HttpResolution addCookie(javax.servlet.http.Cookie cookie)
          Adds a cookie
 HttpResolution 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).
 HttpResolution addCookie(java.lang.String name, java.lang.String value, int maxAge)
          Adds a cookie
 HttpResolution addHeader(java.lang.String name, java.lang.Object value)
          Add a http header.
 HttpResolution setCacheControl(CacheControl cacheControl)
          Sets the cache data to be sent to the browser
 HttpResolution setCharset(java.lang.String charset)
          Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.
 HttpResolution 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.
 HttpResolution setHeader(java.lang.String name, java.lang.Object value)
          Set a String http header.
 HttpResolution setHeaderIfNotPresent(java.lang.String name, java.lang.Object value)
          Set a String http header if it has not been set.
 
Methods inherited from interface org.loom.resolution.Resolution
resolve
 

Method Detail

addCookie

HttpResolution 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).

Parameters:
name - the name of the cookie
value - the value of the Cookie

addCookie

HttpResolution addCookie(java.lang.String name,
                         java.lang.String value,
                         int maxAge)
Adds a cookie

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

HttpResolution addCookie(javax.servlet.http.Cookie cookie)
Adds a cookie

Parameters:
cookie - the cookie to be added to the response

addHeader

HttpResolution addHeader(java.lang.String name,
                         java.lang.Object value)
Add a http header. If the header already exists a new value will be added.

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

HttpResolution setHeader(java.lang.String name,
                         java.lang.Object value)
Set a String http header. If the header already exists it will be replaced.

Parameters:
name - the name of the http header
value - the value of the http header

setHeaderIfNotPresent

HttpResolution setHeaderIfNotPresent(java.lang.String name,
                                     java.lang.Object value)
Set a String http header if it has not been set.

Parameters:
name - the name of the http header
value - the value of the http header

setCharset

HttpResolution setCharset(java.lang.String charset)
Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.


setContentType

HttpResolution 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. 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.


setCacheControl

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

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