|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.jsp.CmsJspBean
org.opencms.jsp.CmsJspActionElement
org.opencms.jsp.util.CmsJspStatusBean
public class CmsJspStatusBean
This bean provides methods to generate customized http status error pages, e.g. to handle 404 (not found) errors.
The JSPs using this bean are placed in the OpenCms VFS folder /system/handler/.
Field Summary | |
---|---|
static java.lang.String |
ERROR_MESSAGE
Request attribute key for the error message. |
static java.lang.String |
ERROR_REQUEST_URI
Request attribute key for the error request URI. |
static java.lang.String |
ERROR_SERVLET_NAME
Request attribute key for the error servlet name. |
static java.lang.String |
ERROR_STATUS_CODE
Request attribute key for the error status code. |
static java.lang.String |
UNKKNOWN_STATUS_CODE
Default name for an unknown error status code. |
static java.lang.String |
VFS_FOLDER_HANDLER
The OpenCms VFS path containing the handler files. |
Fields inherited from class org.opencms.jsp.CmsJspActionElement |
---|
NOT_INITIALIZED |
Constructor Summary | |
---|---|
CmsJspStatusBean()
Empty constructor, required for every JavaBean. |
|
CmsJspStatusBean(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Constructor, with parameters. |
|
CmsJspStatusBean(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.Throwable t)
Constructor, with parameters. |
Method Summary | |
---|---|
java.lang.String |
getErrorMessage()
Returns the error message. |
java.lang.Throwable |
getException()
Returns the exception. |
java.util.Locale |
getLocale()
Returns the locale to use for the error page. |
protected java.lang.Object[] |
getLocalizeParameters()
Returns the parameter object for localization. |
protected CmsMessages |
getMessages()
Returns the initialized messages object to read localized messages from. |
java.lang.String |
getPageContent(java.lang.String element)
Returns the processed output of the specified element of an OpenCms page. |
java.lang.String |
getRequestResourceName()
Returns the absolute path of the requested resource in the VFS of OpenCms. |
java.lang.String |
getRequestUri()
Returns the request Uri. |
java.lang.String |
getResourceUri(java.lang.String resourceName)
Returns the full Workplace resource path to the selected resource. |
java.lang.String |
getServletName()
Returns the servlet name. |
java.lang.String |
getSiteRoot()
Returns the site root of the requested resource. |
java.lang.Integer |
getStatusCode()
Returns the status code. |
java.lang.String |
getStatusCodeMessage()
Returns the status code message. |
java.lang.String |
getTemplateUri()
Returns the URI used for template part inclusion. |
void |
includeTemplatePart(java.lang.String target,
java.lang.String element)
Include a template part to display on the error page. |
void |
includeTemplatePart(java.lang.String target,
java.lang.String element,
java.util.Map parameterMap)
Include a template part to display on the error page. |
protected void |
initMembers(javax.servlet.http.HttpServletRequest req,
java.lang.Throwable t)
Initializes the members of this bean with the information retrieved from the current request. |
java.lang.String |
key(java.lang.String keyName)
Returns the localized resource string for a given message key. |
java.lang.String |
key(java.lang.String keyName,
java.lang.String defaultKeyName)
Returns the localized resource string for a given message key. |
java.lang.String |
keyStatus(java.lang.String keyName)
Returns the localized resource string for a given message key depending on the HTTP status. |
protected void |
setErrorMessage(java.lang.String errorMessage)
Sets the error message. |
protected void |
setException(java.lang.Throwable exception)
Sets the exception. |
protected void |
setLocale(java.util.Locale locale)
Sets the locale to use for the error page. |
protected void |
setLocalizeParameters(java.lang.Object[] localizeParameters)
Sets the parameter object for localization. |
protected void |
setMessages(CmsMessages messages)
Sets the initialized messages object to read localized messages from. |
protected void |
setRequestUri(java.lang.String requestUri)
Sets the request Uri. |
protected void |
setServletName(java.lang.String servletName)
Sets the servlet name. |
protected void |
setSiteRoot(java.lang.String siteRoot)
Sets the site root of the requested resource. |
protected void |
setStatusCode(java.lang.Integer statusCode)
Sets the status code. |
protected void |
setStatusCodeMessage(java.lang.String statusCodeMessage)
Sets the status code message. |
void |
setTemplateUri(java.lang.String templateUri)
Sets the URI used for template part inclusion. |
boolean |
showException()
Returns true if the current user has the "DEVELOPER" role and can view the exception stacktrace. |
Methods inherited from class org.opencms.jsp.CmsJspActionElement |
---|
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, img, img, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user |
Methods inherited from class org.opencms.jsp.CmsJspBean |
---|
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, init, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ERROR_MESSAGE
public static final java.lang.String ERROR_REQUEST_URI
public static final java.lang.String ERROR_SERVLET_NAME
public static final java.lang.String ERROR_STATUS_CODE
public static final java.lang.String UNKKNOWN_STATUS_CODE
public static final java.lang.String VFS_FOLDER_HANDLER
Constructor Detail |
---|
public CmsJspStatusBean()
public CmsJspStatusBean(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
context
- the JSP page context objectreq
- the JSP requestres
- the JSP responsepublic CmsJspStatusBean(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.Throwable t)
context
- the JSP page context objectreq
- the JSP requestres
- the JSP responset
- the exception that lead to the errorMethod Detail |
---|
public java.lang.String getErrorMessage()
public java.lang.Throwable getException()
public java.util.Locale getLocale()
public java.lang.String getPageContent(java.lang.String element)
The page to get the content from is looked up in the property value "template-elements". If no value is found, the page is read from the "contents/" subfolder of the handler folder.
For each status code, an individual page can be created by naming it "content${STATUSCODE}.html". If the individual page can not be found, the content is read from "contentunknown.html".
element
- name of the element
public java.lang.String getRequestResourceName()
public java.lang.String getRequestUri()
public java.lang.String getResourceUri(java.lang.String resourceName)
resourceName
- the name of the resource to get the resource path for
public java.lang.String getServletName()
public java.lang.String getSiteRoot()
public java.lang.Integer getStatusCode()
public java.lang.String getStatusCodeMessage()
public java.lang.String getTemplateUri()
public void includeTemplatePart(java.lang.String target, java.lang.String element) throws javax.servlet.jsp.JspException
target
- the target uri of the file in the OpenCms VFS (can be relative or absolute)element
- the element (template selector) to display from the target
javax.servlet.jsp.JspException
- in case there were problems including the targetpublic void includeTemplatePart(java.lang.String target, java.lang.String element, java.util.Map parameterMap) throws javax.servlet.jsp.JspException
target
- the target uri of the file in the OpenCms VFS (can be relative or absolute)element
- the element (template selector) to display from the targetparameterMap
- a map of the request parameters
javax.servlet.jsp.JspException
- in case there were problems including the targetpublic java.lang.String key(java.lang.String keyName)
If the key was not found in the bundle, the return value is
"??? " + keyName + " ???"
.
The key can use the following parameters for formatting:
keyName
- the key for the desired string
public java.lang.String key(java.lang.String keyName, java.lang.String defaultKeyName)
For a detailed parameter description, see key(String)
.
keyName
- the key for the desired stringdefaultKeyName
- the default key for the desired string, used if the keyName delivered no resource string
public java.lang.String keyStatus(java.lang.String keyName)
Automatically adds a status suffix for the key to get, eg. "keyname" gets the suffix "_404" for a 404 status.
For a detailed parameter description, see key(String)
.
keyName
- the key for the desired string
public void setTemplateUri(java.lang.String templateUri)
templateUri
- the URI used for template part inclusionpublic boolean showException()
protected java.lang.Object[] getLocalizeParameters()
for a more detailed object description
protected CmsMessages getMessages()
protected void initMembers(javax.servlet.http.HttpServletRequest req, java.lang.Throwable t)
req
- the JSP requestt
- the exception that lead to the errorprotected void setErrorMessage(java.lang.String errorMessage)
errorMessage
- the error message to setprotected void setException(java.lang.Throwable exception)
exception
- the exception to setprotected void setLocale(java.util.Locale locale)
locale
- the locale to use for the error pageprotected void setLocalizeParameters(java.lang.Object[] localizeParameters)
localizeParameters
- the parameter object for localizationprotected void setMessages(CmsMessages messages)
messages
- the initialized messages object to read localized messages fromprotected void setRequestUri(java.lang.String requestUri)
requestUri
- the request Uri to setprotected void setServletName(java.lang.String servletName)
servletName
- the servlet name to setprotected void setSiteRoot(java.lang.String siteRoot)
siteRoot
- the site root of the requested resourceprotected void setStatusCode(java.lang.Integer statusCode)
statusCode
- the status code to setprotected void setStatusCodeMessage(java.lang.String statusCodeMessage)
statusCodeMessage
- the status code message to set
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |