|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
helma.framework.ResponseTrans
public final class ResponseTrans
A Transmitter for a response to the servlet client. Objects of this class are directly exposed to JavaScript as global property res.
Field Summary |
---|
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
ResponseTrans(Application app,
RequestTrans req)
Creates a new ResponseTrans object. |
Method Summary | |
---|---|
void |
addDateHeader(java.lang.String name,
java.util.Date value)
Proxy to HttpServletResponse.addDateHeader() |
void |
addHeader(java.lang.String name,
java.lang.String value)
Proxy to HttpServletResponse.addHeader() |
void |
cacheSkin(java.lang.Object id,
Skin skin)
Cache a skin for the length of this response. |
void |
close()
This has to be called after writing to this response has finished and before it is shipped back to the web server. |
void |
close(java.lang.String cset)
This has to be called after writing to this response has finished and before it is shipped back to the web server. |
int |
countCookies()
Get the number of cookies set in this response. |
void |
debug(java.lang.Object message)
Insert string somewhere in the response buffer. |
void |
dependsOn(java.lang.Object what)
Add a dependency to this response. |
void |
digestDependencies()
Digest all dependencies to a checksum to see if the response has changed. |
void |
encode(java.lang.Object what)
Replace special characters with entities, including <, > and ", thus allowing no HTML tags. |
void |
encodeForm(java.lang.Object what)
Encode HTML entities, but leave newlines alone. |
void |
encodeXml(java.lang.Object what)
Replace special characters with entities, including <, > and ", thus allowing no HTML tags. |
void |
flush()
|
void |
format(java.lang.Object what)
Replace special characters with entities but pass through HTML tags |
void |
forward(java.lang.String url)
|
java.lang.Object |
get(java.lang.String name)
Get a value from the responses map by key. |
Skin |
getActiveSkin()
Return the skin currently being rendered, or none. |
java.lang.StringBuffer |
getBuffer()
Get the response buffer, creating it if it doesn't exist |
Skin |
getCachedSkin(java.lang.Object id)
Look up a cached skin. |
java.lang.String |
getCharset()
Get the charset/encoding for this response |
byte[] |
getContent()
Get the body content for this response as byte array, encoded using the response's charset. |
int |
getContentLength()
Get the number of bytes of the response body. |
java.lang.String |
getContentType()
Get the response's MIME content type |
CookieTrans[] |
getCookies()
Get the cookies set in this response. |
java.lang.StringBuffer |
getDebugBuffer()
Get debug messages to append to the response, if any. |
java.lang.Throwable |
getError()
Get the error message to display to the user, if any. |
java.lang.String |
getErrorMessage()
|
java.lang.String |
getETag()
Get the ETag header value for this response. |
java.lang.String |
getForward()
|
long |
getLastModified()
Get the value of the Last-Modified header for this response. |
java.util.Map |
getMacroHandlers()
Get the macro handlers map for this response transmitter. |
java.lang.String |
getMessage()
Get the message to display to the user, if any. |
java.util.Map |
getMetaData()
Get the meta info map for this response transmitter. |
boolean |
getNotModified()
Check if this response should generate a Not-Modified response. |
java.lang.String |
getRealm()
Get the HTTP authentication realm |
java.lang.String |
getRedirect()
|
java.util.Map |
getResponseData()
Get the data map for this response transmitter. |
javax.servlet.http.HttpServletResponse |
getServletResponse()
Returns the ServletResponse instance for this ResponseTrans. |
java.lang.Object[] |
getSkinpath()
Get the path in which to look for skins. |
int |
getStatus()
Get the HTTP response status code |
boolean |
isCacheable()
Returns true if this response may be cached by the client |
java.lang.StringBuffer |
popBuffer()
|
java.lang.String |
popString()
Returns the content of the current string buffer and switches back to the previos one. |
java.lang.StringBuffer |
pushBuffer(java.lang.StringBuffer buf)
This is called before a skin is rendered as string (renderSkinAsString) to redirect the output to a new string buffer. |
void |
redirect(java.lang.String url)
|
void |
reportError(java.lang.String errorMessage)
Write a vanilla error report. |
void |
reportError(java.lang.Throwable throwable)
Write a vanilla error report. |
void |
reset()
Reset the response object to its initial empty state. |
void |
resetBuffer()
Reset the current response buffer. |
void |
resetCookies()
Reset all previously set cookies. |
void |
setCacheable(boolean cache)
Set the cacheability of this response |
void |
setCharset(java.lang.String charset)
Set the charset/encoding for this response |
void |
setContentType(java.lang.String contentType)
Set the response's MIME content type |
void |
setCookie(java.lang.String key,
java.lang.String value,
int days,
java.lang.String path,
java.lang.String domain)
Set a cookie. |
void |
setDateHeader(java.lang.String name,
java.util.Date value)
Proxy to HttpServletResponse.setDateHeader() |
void |
setDebugBuffer(java.lang.StringBuffer debugBuffer)
Set debug messages to append to the response. |
void |
setError(java.lang.Throwable error)
Set a message to display to the user. |
void |
setETag(java.lang.String value)
Set the ETag header value for this response. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Proxy to HttpServletResponse.setHeader() |
void |
setLastModified(long modified)
Set the Last-Modified header for this response |
void |
setMessage(java.lang.String message)
Set a message to display to the user. |
void |
setRealm(java.lang.String realm)
Set the HTTP authentication realm |
void |
setSkinpath(java.lang.Object[] arr)
Set the path in which to look for skins. |
void |
setStatus(int status)
Set the HTTP response status code |
Skin |
switchActiveSkin(Skin skin)
Set the skin currently being rendered, returning the previously active skin. |
void |
waitForClose()
If we just attached to evaluation we call this instead of close because only the primary thread is responsible for closing the result |
void |
write(char[] chars)
Appends a char array to the response buffer. |
void |
write(char[] chars,
int offset,
int length)
Appends a part from a char array to the response buffer. |
void |
write(int c)
Appends a signle character to the response buffer. |
void |
write(java.lang.Object what)
Appends a objct to the response unchanged. |
void |
write(java.lang.String str)
Append a string to the response unchanged. |
void |
write(java.lang.String str,
int offset,
int length)
Appends a part from a string to the response buffer. |
void |
writeBinary(byte[] bytes)
Allow to directly set the byte array for the response. |
void |
writeln()
Writes a platform dependent newline sequence to response buffer. |
void |
writeln(java.lang.Object what)
Write object to response buffer and append a platform dependent newline sequence. |
void |
writeXmlRpcError(java.lang.Exception x)
|
void |
writeXmlRpcResponse(java.lang.Object result)
|
Methods inherited from class java.io.Writer |
---|
append, append, append |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResponseTrans(Application app, RequestTrans req)
req
- the RequestTrans for this responseMethod Detail |
---|
public java.lang.Object get(java.lang.String name)
public java.util.Map getResponseData()
public java.util.Map getMacroHandlers()
public java.util.Map getMetaData()
public javax.servlet.http.HttpServletResponse getServletResponse()
public void resetBuffer()
public void reset()
public java.lang.StringBuffer pushBuffer(java.lang.StringBuffer buf)
buf
- the StringBuffer to use, or null
public java.lang.String popString()
public java.lang.StringBuffer popBuffer()
public java.lang.StringBuffer getBuffer()
public void write(java.lang.String str)
write
in class java.io.Writer
public void write(java.lang.Object what)
public void write(char[] chars, int offset, int length)
write
in class java.io.Writer
chars
- offset
- length
- public void write(char[] chars)
write
in class java.io.Writer
chars
- public void write(int c)
write
in class java.io.Writer
c
- public void write(java.lang.String str, int offset, int length)
write
in class java.io.Writer
str
- offset
- length
- public void writeln(java.lang.Object what)
public void writeln()
public void debug(java.lang.Object message)
public void encode(java.lang.Object what)
public void format(java.lang.Object what)
public void encodeXml(java.lang.Object what)
public void encodeForm(java.lang.Object what)
public void redirect(java.lang.String url) throws RedirectException
url
- ...
RedirectException
- ...public java.lang.String getRedirect()
public void forward(java.lang.String url) throws RedirectException
url
- ...
RedirectException
- ...public java.lang.String getForward()
public void writeBinary(byte[] bytes)
bytes
- an arbitrary byte arraypublic void addHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valuepublic void addDateHeader(java.lang.String name, java.util.Date value)
name
- the header namevalue
- the header valuepublic void setHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valuepublic void setDateHeader(java.lang.String name, java.util.Date value)
name
- the header namevalue
- the header valuepublic void reportError(java.lang.Throwable throwable)
throwable
- the errorpublic void reportError(java.lang.String errorMessage)
errorMessage
- the error messagepublic void writeXmlRpcResponse(java.lang.Object result)
public void writeXmlRpcError(java.lang.Exception x)
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.Writer
public void close() throws java.io.UnsupportedEncodingException
close
in interface java.io.Closeable
close
in class java.io.Writer
java.io.UnsupportedEncodingException
public void close(java.lang.String cset) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public void waitForClose()
public byte[] getContent()
public int getContentLength()
public java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
contentType
- MIME type for this responsepublic void setLastModified(long modified)
modified
- the Last-Modified header in millisecondspublic long getLastModified()
public void setETag(java.lang.String value)
value
- the ETag header valuepublic java.lang.String getETag()
public boolean getNotModified()
public void dependsOn(java.lang.Object what)
what
- an item this response's output depends on.public void digestDependencies()
public void setSkinpath(java.lang.Object[] arr)
arr
- the skin pathpublic java.lang.Object[] getSkinpath()
public Skin getCachedSkin(java.lang.Object id)
id
- the skin key
public void cacheSkin(java.lang.Object id, Skin skin)
id
- the skin keyskin
- the skin to cachepublic Skin switchActiveSkin(Skin skin)
skin
- the new active skin
public Skin getActiveSkin()
public void setCookie(java.lang.String key, java.lang.String value, int days, java.lang.String path, java.lang.String domain)
key
- the cookie keyvalue
- the cookie valuedays
- the cookie's lifespan in dayspath
- the URL path to apply the cookie todomain
- the domain to apply the cookie topublic void resetCookies()
public int countCookies()
public CookieTrans[] getCookies()
public java.lang.String getMessage()
public void setMessage(java.lang.String message)
message
- the messagepublic java.lang.Throwable getError()
public void setError(java.lang.Throwable error)
error
- the error messagepublic java.lang.String getErrorMessage()
public java.lang.StringBuffer getDebugBuffer()
public void setDebugBuffer(java.lang.StringBuffer debugBuffer)
debugBuffer
- the response's debug bufferpublic java.lang.String getCharset()
public void setCharset(java.lang.String charset)
charset
- the charset namepublic boolean isCacheable()
public void setCacheable(boolean cache)
cache
- true if the response may be cachedpublic int getStatus()
public void setStatus(int status)
status
- the HTTP response codepublic java.lang.String getRealm()
public void setRealm(java.lang.String realm)
realm
- the name of the authentication realm
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |