org.opencms.jsp
Class CmsJspTagInclude

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.opencms.jsp.CmsJspTagInclude
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, I_CmsJspTagParamParent

public class CmsJspTagInclude
extends javax.servlet.jsp.tagext.BodyTagSupport
implements I_CmsJspTagParamParent

Implementation of the <cms:include/> tag, used to include another OpenCms managed resource in a JSP.

Since:
6.0.0
Version:
$Revision: 1.49 $
Author:
Alexander Kandzior
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
CmsJspTagInclude()
          Empty constructor, required for attribute value initialization.
 
Method Summary
static void addParameter(java.util.Map parameters, java.lang.String name, java.lang.String value, boolean overwrite)
          Adds parameters to a parameter Map that can be used for a http request.
 void addParameter(java.lang.String name, java.lang.String value)
          This methods adds parameters to the current request.
 int doEndTag()
           
 int doStartTag()
          Returns BodyTag.EVAL_BODY_BUFFERED.
 java.lang.String getAttribute()
          Returns the attribute.
 java.lang.String getCacheable()
          Returns the cacheable flag.
 java.lang.String getEditable()
          Returns the editable flag.
 java.lang.String getElement()
          Returns the element.
 java.lang.String getFile()
          Returns the value of getPage().
 java.lang.String getPage()
          Returns the include page target.
 java.lang.String getProperty()
          Returns the property.
 java.lang.String getSuffix()
          Returns the suffix.
static void includeTagAction(javax.servlet.jsp.PageContext context, java.lang.String target, java.lang.String element, boolean editable, java.util.Map paramMap, javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
          Includes the selected target.
static void includeTagAction(javax.servlet.jsp.PageContext context, java.lang.String target, java.lang.String element, java.util.Locale locale, boolean editable, boolean cacheable, java.util.Map paramMap, javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
          Includes the selected target.
 void release()
           
 void setAttribute(java.lang.String attribute)
          Sets the attribute.
 void setCacheable(java.lang.String cacheable)
          Sets the cacheable flag.
 void setEditable(java.lang.String editable)
          Sets the editable flag.
 void setElement(java.lang.String element)
          Sets the element.
 void setFile(java.lang.String file)
          Sets the file, same as using setPage().
 void setPage(java.lang.String target)
          Sets the include page target.
 void setProperty(java.lang.String property)
          Sets the property.
 void setSuffix(java.lang.String suffix)
          Sets the suffix.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

CmsJspTagInclude

public CmsJspTagInclude()
Empty constructor, required for attribute value initialization.

Method Detail

addParameter

public static void addParameter(java.util.Map parameters,
                                java.lang.String name,
                                java.lang.String value,
                                boolean overwrite)
Adds parameters to a parameter Map that can be used for a http request.

Parameters:
parameters - the Map to add the parameters to
name - the name to add
value - the value to add
overwrite - if true, a parameter in the map will be overwritten by a parameter with the same name, otherwise the request will have multiple parameters with the same name (which is possible in http requests)

includeTagAction

public static void includeTagAction(javax.servlet.jsp.PageContext context,
                                    java.lang.String target,
                                    java.lang.String element,
                                    boolean editable,
                                    java.util.Map paramMap,
                                    javax.servlet.ServletRequest req,
                                    javax.servlet.ServletResponse res)
                             throws javax.servlet.jsp.JspException
Includes the selected target.

Parameters:
context - the current JSP page context
target - the target for the include, might be null
element - the element to select form the target might be null
editable - flag to indicate if the target is editable
paramMap - a map of parameters for the include, will be merged with the request parameters, might be null
req - the current request
res - the current response
Throws:
javax.servlet.jsp.JspException - in case something goes wrong

includeTagAction

public static void includeTagAction(javax.servlet.jsp.PageContext context,
                                    java.lang.String target,
                                    java.lang.String element,
                                    java.util.Locale locale,
                                    boolean editable,
                                    boolean cacheable,
                                    java.util.Map paramMap,
                                    javax.servlet.ServletRequest req,
                                    javax.servlet.ServletResponse res)
                             throws javax.servlet.jsp.JspException
Includes the selected target.

Parameters:
context - the current JSP page context
target - the target for the include, might be null
element - the element to select form the target, might be null
locale - the locale to use for the selected element, might be null
editable - flag to indicate if the target is editable
cacheable - flag to indicate if the target should be cacheable in the Flex cache
paramMap - a map of parameters for the include, will be merged with the request parameters, might be null
req - the current request
res - the current response
Throws:
javax.servlet.jsp.JspException - in case something goes wrong

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
This methods adds parameters to the current request.

Parameters added here will be treated like parameters from the HttpRequest on included pages.

Remember that the value for a parameter in a HttpRequest is a String array, not just a simple String. If a parameter added here does not already exist in the HttpRequest, it will be added. If a parameter exists, another value will be added to the array of values. If the value already exists for the parameter, nothing will be added, since a value can appear only once per parameter.

Specified by:
addParameter in interface I_CmsJspTagParamParent
Parameters:
name - the name to add
value - the value to add
See Also:
I_CmsJspTagParamParent.addParameter(String, String)

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE
Throws:
javax.servlet.jsp.JspException - by interface default
See Also:
Tag.doEndTag()

doStartTag

public int doStartTag()
Returns BodyTag.EVAL_BODY_BUFFERED.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
BodyTag.EVAL_BODY_BUFFERED
See Also:
Tag.doStartTag()

getAttribute

public java.lang.String getAttribute()
Returns the attribute.

Returns:
the attribute

getCacheable

public java.lang.String getCacheable()
Returns the cacheable flag.

Returns:
the cacheable flag

getEditable

public java.lang.String getEditable()
Returns the editable flag.

Returns:
the editable flag

getElement

public java.lang.String getElement()
Returns the element.

Returns:
the element

getFile

public java.lang.String getFile()
Returns the value of getPage().

Returns:
the value of getPage()
See Also:
getPage()

getPage

public java.lang.String getPage()
Returns the include page target.

Returns:
the include page target

getProperty

public java.lang.String getProperty()
Returns the property.

Returns:
the property

getSuffix

public java.lang.String getSuffix()
Returns the suffix.

Returns:
the suffix

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.BodyTagSupport
See Also:
Tag.release()

setAttribute

public void setAttribute(java.lang.String attribute)
Sets the attribute.

Parameters:
attribute - the attribute to set

setCacheable

public void setCacheable(java.lang.String cacheable)
Sets the cacheable flag.

Cachable is true by default.

Parameters:
cacheable - the flag to set

setEditable

public void setEditable(java.lang.String editable)
Sets the editable flag.

Editable is false by default.

Parameters:
editable - the flag to set

setElement

public void setElement(java.lang.String element)
Sets the element.

Parameters:
element - the element to set

setFile

public void setFile(java.lang.String file)
Sets the file, same as using setPage().

Parameters:
file - the file to set
See Also:
setPage(String)

setPage

public void setPage(java.lang.String target)
Sets the include page target.

Parameters:
target - the target to set

setProperty

public void setProperty(java.lang.String property)
Sets the property.

Parameters:
property - the property to set

setSuffix

public void setSuffix(java.lang.String suffix)
Sets the suffix.

Parameters:
suffix - the suffix to set