|
|||||||||
| Home >> All >> com >> opencms >> flex >> [ jsp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.opencms.flex.jsp
Class CmsJspActionElement

java.lang.Objectcom.opencms.flex.jsp.CmsJspActionElement
- public class CmsJspActionElement
- extends java.lang.Object
Bean to be used in JSP scriptlet code that provides direct access to the functionality offered by the opencms taglib.
By instanciating a bean of this type and accessing the methods provided by the instance, all functionality of the OpenCms JSP taglib can be easily used from within JSP scriplet code,
Initialize this bean at the beginning of your JSP like this:
<jsp:useBean id="cms" class="com.opencms.flex.jsp.CmsJspActionElement"> <% cms.init(pageContext, request, response); %> </jsp:useBean>All exceptions that occur when calling any method of this class are catched and written to the log output only, so that a template still has a chance of working at last in some elements.
- Since:
- 5.0 beta 2
- Version:
- $Revision: 1.24.2.1 $
| Field Summary | |
static java.lang.String |
C_NOT_INITIALIZED
Error message in case bean was not properly initialized |
private static int |
DEBUG
DEBUG flag |
private javax.servlet.jsp.PageContext |
m_context
JSP page context |
private com.opencms.flex.cache.CmsFlexController |
m_controller
OpenCms core CmsObject |
private boolean |
m_handleExceptions
Flag to indicate if we want default or custom Exception handling |
private CmsJspNavBuilder |
m_navigation
JSP navigation builder |
private boolean |
m_notInitialized
Flag to indicate that this bean was properly initialized |
private javax.servlet.http.HttpServletRequest |
m_request
OpenCms JSP request |
private javax.servlet.http.HttpServletResponse |
m_response
OpenCms JSP response |
| Constructor Summary | |
CmsJspActionElement()
Empty constructor, required for every JavaBean. |
|
CmsJspActionElement(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Constructor, with parameters. |
|
| Method Summary | |
com.opencms.file.CmsObject |
getCmsObject()
Returns the CmsObject from the wrapped request. |
java.lang.String |
getContent(java.lang.String target)
Returns the processed output of an OpenCms resource in a String. |
boolean |
getHandleExceptions()
Returns true if Exceptions are handled by the class instace, or
false if they will be thrown and have to be handled by the calling class. |
com.opencms.flex.util.CmsMessages |
getMessages(java.lang.String bundleName,
java.lang.String language)
Generates an initialized instance of com.opencms.flex.util.CmsMessages for convenient access to localized resource bundles. |
com.opencms.flex.util.CmsMessages |
getMessages(java.lang.String bundleName,
java.lang.String language,
java.lang.String defaultLanguage)
Generates an initialized instance of com.opencms.flex.util.CmsMessages for convenient access to localized resource bundles. |
com.opencms.flex.util.CmsMessages |
getMessages(java.lang.String bundleName,
java.lang.String language,
java.lang.String country,
java.lang.String variant,
java.lang.String defaultLanguage)
Generates an initialized instance of com.opencms.flex.util.CmsMessages for convenient access to localized resource bundles. |
CmsJspNavBuilder |
getNavigation()
Returns an initialized CmsJspNavBuilder instance. |
javax.servlet.jsp.PageContext |
getPageContext()
Returns the JSP page context wrapped by this element. |
javax.servlet.http.HttpServletRequest |
getRequest()
Returns the request wrapped by the element. |
com.opencms.file.CmsRequestContext |
getRequestContext()
Returns the current request context from the internal CmsObject. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the reponse wrapped by this element. |
private void |
handleException(java.lang.Throwable t)
Handles any exception that might occur in the context of this element to ensure that templates are not disturbed. |
void |
include(java.lang.String target)
Include a sub-element without paramters from the OpenCms VFS, same as using the <cms:include file="..." /> tag. |
void |
include(java.lang.String target,
java.lang.String element)
Include a named sub-element without paramters from the OpenCms VFS, same as using the <cms:include file="..." element="..." /> tag. |
void |
include(java.lang.String target,
java.lang.String element,
java.util.Map parameterMap)
Include a named sub-element with paramters from the OpenCms VFS, same as using the <cms:include file="..." element="..." /> tag
with parameters in the tag body. |
void |
includeSilent(java.lang.String target,
java.lang.String element)
Includes a named sub-element supressing all Exceptions that occur during the include, otherwise the same as using include(String, String, Map null) 55 . |
void |
includeSilent(java.lang.String target,
java.lang.String element,
java.util.Map parameterMap)
Includes a named sub-element supressing all Exceptions that occur during the include, otherwise the same as using include(String, String, Map) 55 . |
java.lang.String |
info(java.lang.String property)
Returns an OpenCms or JVM system info property value, same as using the <cms:info property="..." /> tag. |
void |
init(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Initialize the bean with the current page context, request and response. |
java.lang.String |
label(java.lang.String label)
Returns an OpenCms workplace label. |
java.lang.String |
link(java.lang.String link)
Calculate a link with the OpenCms link management, same as using the <cms:link>...</cms:link> tag. |
java.util.Map |
properties()
Returns all properites of the current file. |
java.util.Map |
properties(java.lang.String file)
Returns all properites of the selected file. |
java.lang.String |
property(java.lang.String name)
Returns a selected file property value, same as using the <cms:property name="..." /> tag or
calling property(String name, String null, String null, boolean false) 55 . |
java.lang.String |
property(java.lang.String name,
java.lang.String file)
Returns a selected file property value, same as using the <cms:property name="..." file="..." /> tag or
calling property(String name, String file, String null, boolean false) 55 . |
java.lang.String |
property(java.lang.String name,
java.lang.String file,
java.lang.String defaultValue)
Returns a selected file property value, same as using the <cms:property name="..." file="..." default="..." /> tag or
calling property(String name, String file, String defaultValue, boolean false) 55 . |
java.lang.String |
property(java.lang.String name,
java.lang.String file,
java.lang.String defaultValue,
boolean escapeHtml)
Returns a selected file property value with optional HTML escaping, same as using the <cms:property name="..." file="..." default="..." /> tag. |
void |
setHandleExceptions(boolean value)
Controls if Exceptions that occur in methods of this class are supressed (true) or not (false). |
boolean |
template(java.lang.String element)
Checks if a template part should be used or not, same as using the <cms:template element="..." /> tag. |
java.lang.String |
toAbsolute(java.lang.String target)
Converts a relative URI in the OpenCms VFS to an absolute one based on the location of the currently processed OpenCms URI. |
java.lang.String |
user(java.lang.String property)
Returns a selected user property, i.e. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
m_request
private javax.servlet.http.HttpServletRequest m_request
- OpenCms JSP request
m_response
private javax.servlet.http.HttpServletResponse m_response
- OpenCms JSP response
m_controller
private com.opencms.flex.cache.CmsFlexController m_controller
- OpenCms core CmsObject
m_context
private javax.servlet.jsp.PageContext m_context
- JSP page context
m_navigation
private CmsJspNavBuilder m_navigation
- JSP navigation builder
m_notInitialized
private boolean m_notInitialized
- Flag to indicate that this bean was properly initialized
m_handleExceptions
private boolean m_handleExceptions
- Flag to indicate if we want default or custom Exception handling
C_NOT_INITIALIZED
public static final java.lang.String C_NOT_INITIALIZED
- Error message in case bean was not properly initialized
- See Also:
- Constant Field Values
DEBUG
private static final int DEBUG
- DEBUG flag
- See Also:
- Constant Field Values
| Constructor Detail |
CmsJspActionElement
public CmsJspActionElement()
- Empty constructor, required for every JavaBean.
CmsJspActionElement
public CmsJspActionElement(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
- Constructor, with parameters.
| Method Detail |
init
public void init(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
- Initialize the bean with the current page context, request and response.
It is required to call one of the init() methods before you can use the instance of this bean.
getHandleExceptions
public boolean getHandleExceptions()
- Returns
trueif Exceptions are handled by the class instace, orfalseif they will be thrown and have to be handled by the calling class.The default is
true. If set tofalseExceptions that occur internally will be wrapped into a RuntimeException and thrown to the calling class instance.Important: Exceptions that occur during a call to
includeSilent(String, String, Map)55 will NOT be handled.
setHandleExceptions
public void setHandleExceptions(boolean value)
- Controls if Exceptions that occur in methods of this class are supressed (true)
or not (false).
The default is
true. If set tofalseall Exceptions that occur internally will be wrapped into a RuntimeException and thrown to the calling class instance.Important: Exceptions that occur during a call to
includeSilent(String, String, Map)55 will NOT be handled.
getRequest
public javax.servlet.http.HttpServletRequest getRequest()
- Returns the request wrapped by the element.
getResponse
public javax.servlet.http.HttpServletResponse getResponse()
- Returns the reponse wrapped by this element.
getPageContext
public javax.servlet.jsp.PageContext getPageContext()
- Returns the JSP page context wrapped by this element.
getCmsObject
public com.opencms.file.CmsObject getCmsObject()
- Returns the CmsObject from the wrapped request.
This is a convenience method in case you need access to the CmsObject in your JSP scriplets.
include
public void include(java.lang.String target) throws javax.servlet.jsp.JspException
- Include a sub-element without paramters from the OpenCms VFS, same as
using the
<cms:include file="..." />tag.
include
public void include(java.lang.String target, java.lang.String element) throws javax.servlet.jsp.JspException
- Include a named sub-element without paramters from the OpenCms VFS, same as
using the
<cms:include file="..." element="..." />tag.
include
public void include(java.lang.String target, java.lang.String element, java.util.Map parameterMap) throws javax.servlet.jsp.JspException
- Include a named sub-element with paramters from the OpenCms VFS, same as
using the
<cms:include file="..." element="..." />tag with parameters in the tag body.The parameter map should be a map where the keys are Strings (the parameter names) and the values are of type String[]. However, as a convenience feature, in case you provide just a String for the parameter value, it will automatically be translated to a String[1].
The handling of the
elementparameter depends on the included file type. Most often it is used as template selector.Important: Exceptions that occur in the include process are NOT handled even if
setHandleExceptions(boolean)55 was set totrue.
includeSilent
public void includeSilent(java.lang.String target, java.lang.String element)
- Includes a named sub-element supressing all Exceptions that occur during the include,
otherwise the same as using
include(String, String, Map null)55 .This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.
includeSilent
public void includeSilent(java.lang.String target, java.lang.String element, java.util.Map parameterMap)
- Includes a named sub-element supressing all Exceptions that occur during the include,
otherwise the same as using
include(String, String, Map)55 .This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.
toAbsolute
public java.lang.String toAbsolute(java.lang.String target)
- Converts a relative URI in the OpenCms VFS to an absolute one based on
the location of the currently processed OpenCms URI.
link
public java.lang.String link(java.lang.String link)
- Calculate a link with the OpenCms link management,
same as using the
<cms:link>...</cms:link>tag.This is important to get the right link for exported resources, e.g. for images in the online project.
user
public java.lang.String user(java.lang.String property)
- Returns a selected user property, i.e. information about the currently
logged in user, same as using
the
<cms:user property="..." />tag.
property
public java.lang.String property(java.lang.String name)
- Returns a selected file property value, same as using
the
<cms:property name="..." />tag or callingproperty(String name, String null, String null, boolean false)55 .
property
public java.lang.String property(java.lang.String name, java.lang.String file)
- Returns a selected file property value, same as using
the
<cms:property name="..." file="..." />tag or callingproperty(String name, String file, String null, boolean false)55 .
property
public java.lang.String property(java.lang.String name, java.lang.String file, java.lang.String defaultValue)
- Returns a selected file property value, same as using
the
<cms:property name="..." file="..." default="..." />tag or callingproperty(String name, String file, String defaultValue, boolean false)55 .
property
public java.lang.String property(java.lang.String name, java.lang.String file, java.lang.String defaultValue, boolean escapeHtml)
- Returns a selected file property value with optional HTML escaping, same as using
the
<cms:property name="..." file="..." default="..." />tag.Please see the description of the class CmsJspTagProperty for valid options of the
fileparameter.
properties
public java.util.Map properties()
- Returns all properites of the current file.
properties
public java.util.Map properties(java.lang.String file)
- Returns all properites of the selected file.
Please see the description of the class CmsJspTagProperty for valid options of the
fileparameter.
info
public java.lang.String info(java.lang.String property)
- Returns an OpenCms or JVM system info property value, same as using
the
<cms:info property="..." />tag.See the description of the class CmsJspTagInfo for a detailed list of available options for the property value.
label
public java.lang.String label(java.lang.String label)
- Returns an OpenCms workplace label.
You should consider using a standard java.util.ResourceBundle instead of the OpenCms workplace language files.
template
public boolean template(java.lang.String element)
- Checks if a template part should be used or not, same as using
the
<cms:template element="..." />tag.
getRequestContext
public com.opencms.file.CmsRequestContext getRequestContext()
- Returns the current request context from the internal CmsObject.
getNavigation
public CmsJspNavBuilder getNavigation()
- Returns an initialized CmsJspNavBuilder instance.
getMessages
public com.opencms.flex.util.CmsMessages getMessages(java.lang.String bundleName, java.lang.String language)
- Generates an initialized instance of com.opencms.flex.util.CmsMessages for
convenient access to localized resource bundles.
getMessages
public com.opencms.flex.util.CmsMessages getMessages(java.lang.String bundleName, java.lang.String language, java.lang.String defaultLanguage)
- Generates an initialized instance of com.opencms.flex.util.CmsMessages for
convenient access to localized resource bundles.
getMessages
public com.opencms.flex.util.CmsMessages getMessages(java.lang.String bundleName, java.lang.String language, java.lang.String country, java.lang.String variant, java.lang.String defaultLanguage)
- Generates an initialized instance of com.opencms.flex.util.CmsMessages for
convenient access to localized resource bundles.
getContent
public java.lang.String getContent(java.lang.String target)
- Returns the processed output of an OpenCms resource in a String.
handleException
private void handleException(java.lang.Throwable t)
- Handles any exception that might occur in the context of this element to
ensure that templates are not disturbed.
|
|||||||||
| Home >> All >> com >> opencms >> flex >> [ jsp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.opencms.flex.jsp.CmsJspActionElement