Package org.opencms.jsp
Class CmsJspTagHeadIncludes
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.opencms.jsp.CmsJspTagHeadIncludes
- All Implemented Interfaces:
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 CmsJspTagHeadIncludes
extends javax.servlet.jsp.tagext.BodyTagSupport
implements I_CmsJspTagParamParent
This tag includes required CSS or JavaScript resources that are to be places in the HTML head.
Required resources can be configured in the resource type schema. Set attribute type to 'css' to include css resources or to 'javascript' to include JavaScript resources.
- Since:
- 8.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The include type CSS.static final String
The include type java-script.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(String name, String value) Add a parameter to this tag.static void
Adds parameters to a parameter Map that can be used for a http request.protected void
collectHeadIncludesForContainerElement
(CmsObject cms, javax.servlet.ServletRequest req, CmsJspStandardContextBean standardContext, CmsContainerPageBean containerPage, String includeType, Set<String> headincludes, Map<String, String> inline) Collects the head includes for a given container element.int
doEndTag()
int
Returns
.BodyTag.EVAL_BODY_BUFFERED
Returns the default include resources separated by '|'.Returns the detail container type.Returns the detail container width.getHeadIncludes
(I_CmsFormatterBean formatter, String type) Gets the head includes for the given formatter bean.protected static String
getInlineData
(I_CmsFormatterBean formatter, String type) Gets the inline CSS/Javascrip for the given formatter bean.getType()
Returns the type.void
setClosetags
(String closeTags) Sets the value of the closetags attribute.void
setDefaults
(String defaults) Sets the default include resources separated by '|'.void
setDetailtype
(String detailType) Sets the detail container type.void
setDetailwidth
(String detailWidth) Sets the detail container width.void
Sets the type.boolean
Returns true if the headincludes tag should be closed.void
tagCssAction
(CmsObject cms, javax.servlet.http.HttpServletRequest req) Action to include the CSS resources.void
tagJSAction
(CmsObject cms, javax.servlet.http.HttpServletRequest req) Action to include the java-script resources.Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, 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
-
Field Details
-
TYPE_CSS
The include type CSS.- See Also:
-
TYPE_JAVASCRIPT
The include type java-script.- See Also:
-
-
Constructor Details
-
CmsJspTagHeadIncludes
public CmsJspTagHeadIncludes()
-
-
Method Details
-
addParameter
public static void addParameter(Map<String, String[]> parameters, String name, 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 toname
- the name to addvalue
- the value to addoverwrite
- iftrue
, 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)
-
getHeadIncludes
Gets the head includes for the given formatter bean.- Parameters:
formatter
- the formatter beantype
- the head include type- Returns:
- the list of head includes
-
getInlineData
Gets the inline CSS/Javascrip for the given formatter bean.- Parameters:
formatter
- the formatter beantype
- the type (CSS or Javascript)- Returns:
- the inline data for the given formatter bean
-
addParameter
Description copied from interface:I_CmsJspTagParamParent
Add a parameter to this tag. The intent is that the <param> subtag will call this to register parameters. Assumes that 'name' and 'value' are appropriately encoded and do not contain any meaningful metacharacters; in order words, escaping is the responsibility of the caller.- Specified by:
addParameter
in interfaceI_CmsJspTagParamParent
- Parameters:
name
- the name of the parametervalue
- the value of the parameter- See Also:
-
doEndTag
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Returns:
EVAL_PAGE
- Throws:
javax.servlet.jsp.JspException
- by interface default- See Also:
-
Tag.doEndTag()
-
doStartTag
Returns
.BodyTag.EVAL_BODY_BUFFERED
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Returns:
BodyTag.EVAL_BODY_BUFFERED
- See Also:
-
Tag.doStartTag()
-
getDefaults
Returns the default include resources separated by '|'.- Returns:
- the default include resources
-
getDetailtype
Returns the detail container type.- Returns:
- the detail container type
-
getDetailwidth
Returns the detail container width.- Returns:
- the detail container width
-
getType
Returns the type.- Returns:
- the type
-
setClosetags
Sets the value of the closetags attribute.- Parameters:
closeTags
- the value of the closetags attribute
-
setDefaults
Sets the default include resources separated by '|'.- Parameters:
defaults
- the default include resources to set
-
setDetailtype
Sets the detail container type.- Parameters:
detailType
- the detail container type to set
-
setDetailwidth
Sets the detail container width.- Parameters:
detailWidth
- the detail container width to set
-
setType
Sets the type.- Parameters:
type
- the type to set
-
shouldCloseTags
Returns true if the headincludes tag should be closed.- Returns:
- true if the headincludes tag should be closed
-
tagCssAction
public void tagCssAction(CmsObject cms, javax.servlet.http.HttpServletRequest req) throws CmsException, IOException Action to include the CSS resources.- Parameters:
cms
- the current cms contextreq
- the current request- Throws:
CmsException
- if something goes wrong reading the resourcesIOException
- if something goes wrong writing to the response out
-
tagJSAction
public void tagJSAction(CmsObject cms, javax.servlet.http.HttpServletRequest req) throws CmsException, IOException Action to include the java-script resources.- Parameters:
cms
- the current cms contextreq
- the current request- Throws:
CmsException
- if something goes wrong reading the resourcesIOException
- if something goes wrong writing to the response out
-
collectHeadIncludesForContainerElement
protected void collectHeadIncludesForContainerElement(CmsObject cms, javax.servlet.ServletRequest req, CmsJspStandardContextBean standardContext, CmsContainerPageBean containerPage, String includeType, Set<String> headincludes, Map<String, String> inline) Collects the head includes for a given container element.- Parameters:
cms
- the current CMS contextreq
- the current requeststandardContext
- the current standard contextcontainerPage
- the current container pageincludeType
- the type of head includes (CSS or Javascript)headincludes
- the set to which normal head includes should be addedinline
- the map to which inline head includes should be added
-