Class CmsJspTagHeadIncludes

  • 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 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:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TYPE_CSS
      The include type CSS.
      static java.lang.String TYPE_JAVASCRIPT
      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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addParameter​(java.lang.String name, java.lang.String value)
      Add a parameter to this tag.
      static void addParameter​(java.util.Map<java.lang.String,​java.lang.String[]> 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.
      protected void collectHeadIncludesForContainerElement​(CmsObject cms, javax.servlet.ServletRequest req, CmsJspStandardContextBean standardContext, CmsContainerPageBean containerPage, java.lang.String includeType, java.util.Set<java.lang.String> headincludes, java.util.Map<java.lang.String,​java.lang.String> inline)
      Collects the head includes for a given container element.
      int doEndTag()  
      int doStartTag()
      Returns BodyTag.EVAL_BODY_BUFFERED.
      java.lang.String getDefaults()
      Returns the default include resources separated by '|'.
      java.lang.String getDetailtype()
      Returns the detail container type.
      java.lang.String getDetailwidth()
      Returns the detail container width.
      protected static java.util.List<java.lang.String> getHeadIncludes​(I_CmsFormatterBean formatter, java.lang.String type)
      Gets the head includes for the given formatter bean.
      protected static java.lang.String getInlineData​(I_CmsFormatterBean formatter, java.lang.String type)
      Gets the inline CSS/Javascrip for the given formatter bean.
      java.lang.String getType()
      Returns the type.
      void setClosetags​(java.lang.String closeTags)
      Sets the value of the closetags attribute.
      void setDefaults​(java.lang.String defaults)
      Sets the default include resources separated by '|'.
      void setDetailtype​(java.lang.String detailType)
      Sets the detail container type.
      void setDetailwidth​(java.lang.String detailWidth)
      Sets the detail container width.
      void setType​(java.lang.String type)
      Sets the type.
      boolean shouldCloseTags()
      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
    • Method Detail

      • addParameter

        public static void addParameter​(java.util.Map<java.lang.String,​java.lang.String[]> 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)
      • getHeadIncludes

        protected static java.util.List<java.lang.String> getHeadIncludes​(I_CmsFormatterBean formatter,
                                                                          java.lang.String type)
        Gets the head includes for the given formatter bean.

        Parameters:
        formatter - the formatter bean
        type - the head include type
        Returns:
        the list of head includes
      • getInlineData

        protected static java.lang.String getInlineData​(I_CmsFormatterBean formatter,
                                                        java.lang.String type)
        Gets the inline CSS/Javascrip for the given formatter bean.

        Parameters:
        formatter - the formatter bean
        type - the type (CSS or Javascript)
        Returns:
        the inline data for the given formatter bean
      • 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()
      • getDefaults

        public java.lang.String getDefaults()
        Returns the default include resources separated by '|'.

        Returns:
        the default include resources
      • getDetailtype

        public java.lang.String getDetailtype()
        Returns the detail container type.

        Returns:
        the detail container type
      • getDetailwidth

        public java.lang.String getDetailwidth()
        Returns the detail container width.

        Returns:
        the detail container width
      • getType

        public java.lang.String getType()
        Returns the type.

        Returns:
        the type
      • setClosetags

        public void setClosetags​(java.lang.String closeTags)
        Sets the value of the closetags attribute.

        Parameters:
        closeTags - the value of the closetags attribute
      • setDefaults

        public void setDefaults​(java.lang.String defaults)
        Sets the default include resources separated by '|'.

        Parameters:
        defaults - the default include resources to set
      • setDetailtype

        public void setDetailtype​(java.lang.String detailType)
        Sets the detail container type.

        Parameters:
        detailType - the detail container type to set
      • setDetailwidth

        public void setDetailwidth​(java.lang.String detailWidth)
        Sets the detail container width.

        Parameters:
        detailWidth - the detail container width to set
      • setType

        public void setType​(java.lang.String type)
        Sets the type.

        Parameters:
        type - the type to set
      • shouldCloseTags

        public boolean 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,
                                 java.io.IOException
        Action to include the CSS resources.

        Parameters:
        cms - the current cms context
        req - the current request
        Throws:
        CmsException - if something goes wrong reading the resources
        java.io.IOException - if something goes wrong writing to the response out
      • tagJSAction

        public void tagJSAction​(CmsObject cms,
                                javax.servlet.http.HttpServletRequest req)
                         throws CmsException,
                                java.io.IOException
        Action to include the java-script resources.

        Parameters:
        cms - the current cms context
        req - the current request
        Throws:
        CmsException - if something goes wrong reading the resources
        java.io.IOException - if something goes wrong writing to the response out
      • collectHeadIncludesForContainerElement

        protected void collectHeadIncludesForContainerElement​(CmsObject cms,
                                                              javax.servlet.ServletRequest req,
                                                              CmsJspStandardContextBean standardContext,
                                                              CmsContainerPageBean containerPage,
                                                              java.lang.String includeType,
                                                              java.util.Set<java.lang.String> headincludes,
                                                              java.util.Map<java.lang.String,​java.lang.String> inline)
        Collects the head includes for a given container element.

        Parameters:
        cms - the current CMS context
        req - the current request
        standardContext - the current standard context
        containerPage - the current container page
        includeType - the type of head includes (CSS or Javascript)
        headincludes - the set to which normal head includes should be added
        inline - the map to which inline head includes should be added