|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.opencms.core.CmsResponseHttpServlet
Implementation of the I_CmsResponse interface which wraps a HttpServletResponse and provides OpenCms with a facility to handle redirects.
| Method Summary | |
void |
addHeader(String key,
String value)
Add a header-field in the response. |
static boolean |
checkJsdk()
Check the JSDK version available at runtime. |
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, which will be a C_RESPONSE_HTTP value for this wrapper implementation. |
OutputStream |
getOutputStream()
Returns an OutputStream for writing the response data. |
boolean |
isOutputWritten()
Check if the output stream was written 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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static boolean checkJsdk()
true if JSDK 2, false if JSDK 1public Object getOriginalResponse()
getOriginalResponse in interface I_CmsResponsepublic int getOriginalResponseType()
getOriginalResponseType in interface I_CmsResponse
public OutputStream getOutputStream()
throws IOException
getOutputStream in interface I_CmsResponseIOException - if an error occurspublic boolean isOutputWritten()
isOutputWritten in interface I_CmsResponsetrue if getOutputStream() was called, false otherwise.public boolean isRedirected()
isRedirected in interface I_CmsResponsetrue if the request is redirected, false otherwise.
public void sendCmsRedirect(String location)
throws IOException
sendCmsRedirect in interface I_CmsResponselocation - The location the response is send to.
IOException - if an error occurs
public void sendError(int code)
throws IOException
sendError in interface I_CmsResponsecode - The error code to be set.
IOException - if an error occurs
public void sendError(int code,
String msg)
throws IOException
sendError in interface I_CmsResponsecode - The error code to be set.msg - Additional error message.
IOException - if an error occurs
public void sendRedirect(String location)
throws IOException
location has the same hostname as the host of this servlet use the cluster url.
sendRedirect in interface I_CmsResponselocation - a full url, eg. http://servername/servlets/opencms/index.html
IOException - if an error occurspublic void setContentLength(int len)
setContentLength in interface I_CmsResponselen - Number of bytes to be returned by the response.public void setContentType(String type)
setContentType in interface I_CmsResponsetype - The contnent type of the response.public String getContentType()
setContentType(java.lang.String).
getContentType in interface I_CmsResponse
public void setHeader(String key,
String value)
setHeader in interface I_CmsResponsekey - The key for the header.value - The value for the header.
public void addHeader(String key,
String value)
addHeader in interface I_CmsResponsekey - The key for the header.value - The value for the header.public void setLastModified(long time)
setLastModified in interface I_CmsResponsetime - The last-modified time.public boolean containsHeader(String key)
containsHeader in interface I_CmsResponse
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||