|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.loom.resolution.AbstractHttpResolution
org.loom.resolution.JacksonResolution
public class JacksonResolution
A resolution that uses Jackson to serialize a JSON response.
| Constructor Summary | |
|---|---|
JacksonResolution(org.codehaus.jackson.map.ObjectMapper mapper,
java.lang.Object contents)
|
|
| Method Summary | |
|---|---|
JacksonResolution |
addCookie(javax.servlet.http.Cookie cookie)
Adds a cookie |
JacksonResolution |
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). |
JacksonResolution |
addCookie(java.lang.String name,
java.lang.String value,
int maxAge)
Adds a cookie |
JacksonResolution |
addHeader(java.lang.String name,
java.lang.Object value)
Add a http header. |
java.lang.Object |
getContents()
|
org.codehaus.jackson.map.ObjectMapper |
getMapper()
|
void |
resolve(LoomServletRequest request,
LoomServletResponse response)
Write the response contents |
JacksonResolution |
setCacheControl(CacheControl cacheControl)
Sets the cache data to be sent to the browser |
JacksonResolution |
setCharset(java.lang.String charset)
Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. |
JacksonResolution |
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. |
JacksonResolution |
setHeader(java.lang.String name,
java.lang.Object value)
Set a String http header. |
JacksonResolution |
setHeaderIfNotPresent(java.lang.String name,
java.lang.Object value)
Set a String http header if it has not been set. |
java.lang.String |
toString()
|
JacksonResolution |
withView(java.lang.Class<?> viewClass)
Specify the jackson view to use for serializing |
| 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 |
|---|
public JacksonResolution(org.codehaus.jackson.map.ObjectMapper mapper,
java.lang.Object contents)
| Method Detail |
|---|
public void resolve(LoomServletRequest request,
LoomServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
Resolution
resolve in interface Resolutionresolve in class AbstractHttpResolutionrequest - the current request objectresponse - the current response object
java.io.IOException
javax.servlet.ServletExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic JacksonResolution withView(java.lang.Class<?> viewClass)
public org.codehaus.jackson.map.ObjectMapper getMapper()
public java.lang.Object getContents()
public JacksonResolution addCookie(java.lang.String name,
java.lang.String value)
HttpResolution
addCookie in interface HttpResolutionaddCookie in class AbstractHttpResolutionname - the name of the cookievalue - the value of the Cookie
public JacksonResolution addCookie(java.lang.String name,
java.lang.String value,
int maxAge)
HttpResolution
addCookie in interface HttpResolutionaddCookie in class AbstractHttpResolutionname - the name of the cookievalue - the value of the CookiemaxAge - 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).public JacksonResolution addCookie(javax.servlet.http.Cookie cookie)
HttpResolution
addCookie in interface HttpResolutionaddCookie in class AbstractHttpResolutioncookie - the cookie to be added to the response
public JacksonResolution addHeader(java.lang.String name,
java.lang.Object value)
HttpResolution
addHeader in interface HttpResolutionaddHeader in class AbstractHttpResolutionname - the name of the http headervalue - the value of the http header. Date, int and String are supported. Anything else will be cast to toString(). Null will be ignored.
public JacksonResolution setHeader(java.lang.String name,
java.lang.Object value)
HttpResolution
setHeader in interface HttpResolutionsetHeader in class AbstractHttpResolutionname - the name of the http headervalue - the value of the http header
public JacksonResolution setHeaderIfNotPresent(java.lang.String name,
java.lang.Object value)
HttpResolution
setHeaderIfNotPresent in interface HttpResolutionsetHeaderIfNotPresent in class AbstractHttpResolutionname - the name of the http headervalue - the value of the http headerpublic JacksonResolution setCharset(java.lang.String charset)
HttpResolution
setCharset in interface HttpResolutionsetCharset in class AbstractHttpResolutionpublic JacksonResolution setContentType(java.lang.String contentType)
HttpResolutiontext/html;charset=UTF-8.
Notice that #setCharset(String) can also be used for this.
setContentType in interface HttpResolutionsetContentType in class AbstractHttpResolutionpublic JacksonResolution setCacheControl(CacheControl cacheControl)
CacheableResolution
setCacheControl in interface CacheableResolutionsetCacheControl in interface HttpResolutionsetCacheControl in class AbstractHttpResolutioncacheControl - the cache data.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||