|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.loom.resolution.AbstractHttpResolution
org.loom.resolution.AbstractFileResolution
public abstract class AbstractFileResolution
Delivers a binary file to the browser
Constructor Summary | |
---|---|
AbstractFileResolution()
|
Method Summary | |
---|---|
AbstractFileResolution |
addCookie(javax.servlet.http.Cookie cookie)
Adds a cookie |
AbstractFileResolution |
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). |
AbstractFileResolution |
addCookie(java.lang.String name,
java.lang.String value,
int maxAge)
Adds a cookie |
AbstractFileResolution |
addHeader(java.lang.String name,
java.lang.Object value)
Add a http header. |
java.lang.String |
calculateContentDispositionHeader(java.lang.String filename)
|
java.lang.String |
getFilename()
|
java.lang.Long |
getFileSize()
|
boolean |
isForceSave()
|
boolean |
isGuessMimeType()
|
abstract void |
resolve(LoomServletRequest request,
LoomServletResponse response)
Write the response contents |
AbstractFileResolution |
setCacheControl(CacheControl cacheControl)
Sets the cache data to be sent to the browser |
AbstractFileResolution |
setCharset(java.lang.String charset)
Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. |
AbstractFileResolution |
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. |
AbstractFileResolution |
setFilename(java.lang.String filename)
|
AbstractFileResolution |
setFileSize(java.lang.Long fileSize)
|
AbstractFileResolution |
setForceSave(boolean forceSave)
|
AbstractFileResolution |
setGuessMimeType(boolean guessMimeType)
|
AbstractFileResolution |
setHeader(java.lang.String name,
java.lang.Object value)
Set a String http header. |
AbstractFileResolution |
setHeaderIfNotPresent(java.lang.String name,
java.lang.Object value)
Set a String http header if it has not been set. |
protected void |
writeHeaders(LoomServletRequest request,
LoomServletResponse response)
Calculate default content size, content type, etc headers that will be applied if the user did not provide one previously. |
Methods inherited from class org.loom.resolution.AbstractHttpResolution |
---|
addDateHeader, addIntHeader, containsHeader, getCacheControl, getCharset, getContentType, setDateHeader, setDateHeaderIfNotPresent, setIntHeader, setIntHeaderIfNotPresent, setJsonHeader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractFileResolution()
Method Detail |
---|
public abstract void resolve(LoomServletRequest request, LoomServletResponse response) throws java.io.IOException, javax.servlet.ServletException
Resolution
resolve
in interface Resolution
resolve
in class AbstractHttpResolution
request
- the current request objectresponse
- the current response object
java.io.IOException
javax.servlet.ServletException
protected void writeHeaders(LoomServletRequest request, LoomServletResponse response)
writeHeaders
in class AbstractHttpResolution
public java.lang.String calculateContentDispositionHeader(java.lang.String filename)
public AbstractFileResolution setForceSave(boolean forceSave)
public boolean isGuessMimeType()
public AbstractFileResolution setGuessMimeType(boolean guessMimeType)
public boolean isForceSave()
public java.lang.String getFilename()
public AbstractFileResolution setFilename(java.lang.String filename)
public java.lang.Long getFileSize()
public AbstractFileResolution setFileSize(java.lang.Long fileSize)
public AbstractFileResolution addCookie(java.lang.String name, java.lang.String value)
HttpResolution
addCookie
in interface HttpResolution
addCookie
in class AbstractHttpResolution
name
- the name of the cookievalue
- the value of the Cookiepublic AbstractFileResolution addCookie(java.lang.String name, java.lang.String value, int maxAge)
HttpResolution
addCookie
in interface HttpResolution
addCookie
in class AbstractHttpResolution
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 AbstractFileResolution addCookie(javax.servlet.http.Cookie cookie)
HttpResolution
addCookie
in interface HttpResolution
addCookie
in class AbstractHttpResolution
cookie
- the cookie to be added to the responsepublic AbstractFileResolution addHeader(java.lang.String name, java.lang.Object value)
HttpResolution
addHeader
in interface HttpResolution
addHeader
in class AbstractHttpResolution
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 AbstractFileResolution setHeader(java.lang.String name, java.lang.Object value)
HttpResolution
setHeader
in interface HttpResolution
setHeader
in class AbstractHttpResolution
name
- the name of the http headervalue
- the value of the http headerpublic AbstractFileResolution setHeaderIfNotPresent(java.lang.String name, java.lang.Object value)
HttpResolution
setHeaderIfNotPresent
in interface HttpResolution
setHeaderIfNotPresent
in class AbstractHttpResolution
name
- the name of the http headervalue
- the value of the http headerpublic AbstractFileResolution setCharset(java.lang.String charset)
HttpResolution
setCharset
in interface HttpResolution
setCharset
in class AbstractHttpResolution
public AbstractFileResolution 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
setContentType
in class AbstractHttpResolution
public AbstractFileResolution setCacheControl(CacheControl cacheControl)
CacheableResolution
setCacheControl
in interface CacheableResolution
setCacheControl
in interface HttpResolution
setCacheControl
in class AbstractHttpResolution
cacheControl
- the cache data.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |