|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.loom.resolution.AbstractHttpResolution
public abstract class AbstractHttpResolution
A response object with http headers.
Constructor Summary | |
---|---|
AbstractHttpResolution()
|
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 |
void |
addDateHeader(java.lang.String name,
java.util.Date value)
Deprecated. use addHeader(String, Object) instead |
HttpResolution |
addHeader(java.lang.String name,
java.lang.Object value)
Add a http header. |
void |
addIntHeader(java.lang.String name,
int value)
Deprecated. use addHeader(String, Object) instead |
boolean |
containsHeader(java.lang.String name)
|
CacheControl |
getCacheControl()
|
java.lang.String |
getCharset()
|
java.lang.String |
getContentType()
|
abstract void |
resolve(LoomServletRequest request,
LoomServletResponse response)
Write the response contents |
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. |
void |
setDateHeader(java.lang.String name,
java.util.Date value)
Deprecated. use setHeader(String, Object) instead |
void |
setDateHeaderIfNotPresent(java.lang.String name,
java.util.Date value)
Deprecated. use setHeaderIfNotPresent(String, Object) instead |
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. |
void |
setIntHeader(java.lang.String name,
int value)
Deprecated. use setHeader(String, Object) instead |
void |
setIntHeaderIfNotPresent(java.lang.String name,
int value)
Deprecated. use setHeaderIfNotPresent(String, Object) instead |
void |
setJsonHeader(JsonMarshaller marshaller)
Deprecated. use jackson instead |
protected void |
writeHeaders(LoomServletRequest request,
LoomServletResponse response)
Adds http headers to the response before resolving |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractHttpResolution()
Method Detail |
---|
public abstract void resolve(LoomServletRequest request, LoomServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Resolution
resolve
in interface Resolution
request
- the current request objectresponse
- the current response object
java.io.IOException
javax.servlet.ServletException
protected void writeHeaders(LoomServletRequest request, LoomServletResponse response)
public HttpResolution addCookie(java.lang.String name, java.lang.String value)
HttpResolution
addCookie
in interface HttpResolution
name
- the name of the cookievalue
- the value of the Cookiepublic HttpResolution addCookie(java.lang.String name, java.lang.String value, int maxAge)
HttpResolution
addCookie
in interface HttpResolution
name
- 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 HttpResolution addCookie(javax.servlet.http.Cookie cookie)
HttpResolution
addCookie
in interface HttpResolution
cookie
- the cookie to be added to the responsepublic HttpResolution addHeader(java.lang.String name, java.lang.Object value)
HttpResolution
addHeader
in interface HttpResolution
name
- 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 void addDateHeader(java.lang.String name, java.util.Date value)
name
- the name of the http headervalue
- the value of the http headerpublic void addIntHeader(java.lang.String name, int value)
name
- the name of the http headervalue
- the value of the http headerpublic HttpResolution setHeader(java.lang.String name, java.lang.Object value)
HttpResolution
setHeader
in interface HttpResolution
name
- the name of the http headervalue
- the value of the http headerpublic HttpResolution setHeaderIfNotPresent(java.lang.String name, java.lang.Object value)
HttpResolution
setHeaderIfNotPresent
in interface HttpResolution
name
- the name of the http headervalue
- the value of the http headerpublic void setDateHeader(java.lang.String name, java.util.Date value)
name
- the name of the http headervalue
- the value of the http headerpublic void setDateHeaderIfNotPresent(java.lang.String name, java.util.Date value)
name
- the name of the http headervalue
- the value of the http headerpublic void setIntHeader(java.lang.String name, int value)
name
- the name of the http headervalue
- the value of the http headerpublic void setIntHeaderIfNotPresent(java.lang.String name, int value)
name
- the name of the http headervalue
- the value of the http headerpublic void setJsonHeader(JsonMarshaller marshaller)
marshaller
- the JSON object to be added as http headerpublic boolean containsHeader(java.lang.String name)
name
- the http header name to check
public CacheControl getCacheControl()
public HttpResolution setCacheControl(CacheControl cacheControl)
CacheableResolution
setCacheControl
in interface CacheableResolution
setCacheControl
in interface HttpResolution
cacheControl
- the cache data.
public java.lang.String getContentType()
public HttpResolution setContentType(java.lang.String contentType)
HttpResolution
text/html;charset=UTF-8
.
Notice that #setCharset(String) can also be used for this.
setContentType
in interface HttpResolution
public java.lang.String getCharset()
public HttpResolution setCharset(java.lang.String charset)
HttpResolution
setCharset
in interface HttpResolution
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |