Package org.apache.wicket.markup.head
Class MetaDataHeaderItem
- java.lang.Object
-
- org.apache.wicket.markup.head.HeaderItem
-
- org.apache.wicket.markup.head.MetaDataHeaderItem
-
- All Implemented Interfaces:
java.io.Serializable
,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
HtmlImportHeaderItem
public class MetaDataHeaderItem extends HeaderItem
HeaderItem
for meta information such as <meta> tags or canonical <link>- Since:
- 6.17.0
- Author:
- andrea del bene
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MetaDataHeaderItem(java.lang.String tagName)
Build a newMetaDataHeaderItem
havingtagName
as tag.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MetaDataHeaderItem
addTagAttribute(java.lang.String attributeName)
Add a minimized tag attribute to the item.MetaDataHeaderItem
addTagAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
Add a tag attribute to the item.boolean
equals(java.lang.Object o)
static MetaDataHeaderItem
forLinkTag(java.lang.String rel, java.lang.String href)
Factory method to create <link> tag.static MetaDataHeaderItem
forLinkTag(IModel<java.lang.String> rel, IModel<java.lang.String> href)
Factory method to create <link> tag.static MetaDataHeaderItem
forMetaTag(java.lang.String name, java.lang.String content)
Factory method to create <meta> tag.static MetaDataHeaderItem
forMetaTag(IModel<java.lang.String> name, IModel<java.lang.String> content)
Factory method to create <meta> tag.java.lang.String
generateString()
Generate the string representation for the current item.java.lang.Iterable<?>
getRenderTokens()
int
hashCode()
void
render(org.apache.wicket.request.Response response)
Renders theHeaderItem
to the response.-
Methods inherited from class org.apache.wicket.markup.head.HeaderItem
getDependencies, getProvidedResources
-
-
-
-
Field Detail
-
META_TAG
public static final java.lang.String META_TAG
The meta tag name- See Also:
- Constant Field Values
-
LINK_TAG
public static final java.lang.String LINK_TAG
the link tag name- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MetaDataHeaderItem
public MetaDataHeaderItem(java.lang.String tagName)
Build a newMetaDataHeaderItem
havingtagName
as tag.- Parameters:
tagName
- the name of the tag
-
-
Method Detail
-
addTagAttribute
public MetaDataHeaderItem addTagAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
Add a tag attribute to the item. If the attribute value is aIModel
, the object wrapped inside the model is used as actual value.- Parameters:
attributeName
- the attribute nameattributeValue
- the attribute value- Returns:
- The current item.
-
addTagAttribute
public MetaDataHeaderItem addTagAttribute(java.lang.String attributeName)
Add a minimized tag attribute to the item. The attribute has no value and only its name is rendered (for example 'async')- Parameters:
attributeName
- the attribute name- Returns:
- The current item.
-
generateString
public java.lang.String generateString()
Generate the string representation for the current item.- Returns:
- The string representation for the current item.
-
getRenderTokens
public java.lang.Iterable<?> getRenderTokens()
- Specified by:
getRenderTokens
in classHeaderItem
- Returns:
- The tokens this
HeaderItem
can be identified by. If any of the tokens has already been rendered, thisHeaderItem
will not be rendered.
-
render
public void render(org.apache.wicket.request.Response response)
Description copied from class:HeaderItem
Renders theHeaderItem
to the response.- Specified by:
render
in classHeaderItem
-
forMetaTag
public static MetaDataHeaderItem forMetaTag(java.lang.String name, java.lang.String content)
Factory method to create <meta> tag.- Parameters:
name
- the 'name' attribute of the tagcontent
- the 'content' attribute of the tag- Returns:
- A new
MetaDataHeaderItem
-
forMetaTag
public static MetaDataHeaderItem forMetaTag(IModel<java.lang.String> name, IModel<java.lang.String> content)
Factory method to create <meta> tag.- Parameters:
name
- the 'name' attribute of the tag as String modelcontent
- the 'content' attribute of the tag as String model- Returns:
- A new
MetaDataHeaderItem
-
forLinkTag
public static MetaDataHeaderItem forLinkTag(java.lang.String rel, java.lang.String href)
Factory method to create <link> tag.- Parameters:
rel
- the 'rel' attribute of the taghref
- the 'href' attribute of the tag- Returns:
- A new
MetaDataHeaderItem
-
forLinkTag
public static MetaDataHeaderItem forLinkTag(IModel<java.lang.String> rel, IModel<java.lang.String> href)
Factory method to create <link> tag.- Parameters:
rel
- the 'rel' attribute of the tag as String modelhref
- the 'href' attribute of the tag as String model- Returns:
- A new
MetaDataHeaderItem
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-