|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface defines an OpenCms response, a generic response object that is used by OpenCms and provides methods to send processed data back to the requesting user.
Implementations of this interface use an existing response (e.g. HttpServletResponse) to initialize an I_CmsResponse.
| Method Summary | |
void |
addHeader(String key,
String value)
Add a header-field in the response. |
boolean |
containsHeader(String key)
Checks, if the header was set already. |
String |
getContentType()
Returns the content type of the response which has previously been set using setContentType(java.lang.String). |
Object |
getOriginalResponse()
Returns the original response that was used to create the CmsResponse. |
int |
getOriginalResponseType()
Returns the type of the response that was used to create the CmsResponse. |
OutputStream |
getOutputStream()
Returns an OutputStream for writing the response data. |
boolean |
isOutputWritten()
Check if the output stream was requested previously. |
boolean |
isRedirected()
Check if the current request was redirected. |
void |
sendCmsRedirect(String location)
Sets a redirect to send the responst to. |
void |
sendError(int code)
Sets the error code that is returnd by the response. |
void |
sendError(int code,
String msg)
Sets the error code and a additional message that is returnd by the response. |
void |
sendRedirect(String location)
Helper function for a redirect to the cluster url. |
void |
setContentLength(int len)
Sets the length of the content being returned by the server. |
void |
setContentType(String type)
Sets the content type of the response to the specified type. |
void |
setHeader(String key,
String value)
Sets a header-field in the response. |
void |
setLastModified(long time)
Sets the last modified header-field in the response. |
| Method Detail |
public Object getOriginalResponse()
public int getOriginalResponseType()
public OutputStream getOutputStream()
throws IOException
Throws - IOException if an error occurs.
IOExceptionpublic boolean isOutputWritten()
true if getOutputStream() was called, false otherwise.public boolean isRedirected()
true if the request is redirected, false otherwise.
public void sendCmsRedirect(String location)
throws IOException
location - The location the response is send to.
Throws - IOException if an error occurs.
IOException
public void sendError(int code)
throws IOException
code - The error code to be set.
Throws - IOException if an error occurs.
IOException
public void sendError(int code,
String msg)
throws IOException
code - The error code to be set.msg - Additional error message.
Throws - IOException if an error occurs.
IOException
public void sendRedirect(String location)
throws IOException
location - a complete url, eg. http://servername/servlets/opencms/index.html
Throws - IOException if an error occurs.
IOExceptionpublic void setContentLength(int len)
len - Number of bytes to be returned by the response.public void setContentType(String type)
type - The contnent type of the response.public String getContentType()
setContentType(java.lang.String).
public void setHeader(String key,
String value)
key - The key for the header.value - The value for the header.
public void addHeader(String key,
String value)
key - The key for the header.value - The value for the header.public void setLastModified(long time)
time - The last-modified time.public boolean containsHeader(String key)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||