public abstract class JavaScriptHeaderItem extends HeaderItem
HeaderItem
s that represent javascripts. This class mainly contains
factory methods.Modifier | Constructor and Description |
---|---|
protected |
JavaScriptHeaderItem(String condition) |
getDependencies, getProvidedResources, getRenderTokens, render
protected JavaScriptHeaderItem(String condition)
public String getId()
public JavaScriptHeaderItem setId(String markupId)
markupId
- the markup idthis
object, for method chainingpublic String getCondition()
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the javascript resourceJavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, String id)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the javascript resourceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)JavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)JavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id, boolean defer)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.JavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, String id, boolean defer)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the JavaScript resourceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.JavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, boolean defer)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the JavaScript resourcedefer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.JavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id, boolean defer, String charset)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.charset
- a non null value specifies the charset attribute of the script tagJavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id, boolean defer, String charset, String condition)
JavaScriptReferenceHeaderItem
for the given reference.reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.charset
- a non null value specifies the charset attribute of the script tagcondition
- the condition to use for Internet Explorer conditional comments. E.g. "IE 7".JavaScriptReferenceHeaderItem
for the given reference.public static JavaScriptContentHeaderItem forScript(CharSequence javascript, String id)
JavaScriptContentHeaderItem
for the given content.javascript
- javascript content to be rendered.id
- unique id for the javascript element. This can be null, however in that case the
ajax header contribution can't detect duplicate script fragments.JavaScriptContentHeaderItem
for the given content.public static JavaScriptContentHeaderItem forScript(CharSequence javascript, String id, String condition)
JavaScriptContentHeaderItem
for the given content.javascript
- javascript content to be rendered.id
- unique id for the javascript element. This can be null, however in that case the
ajax header contribution can't detect duplicate script fragments.condition
- the condition to use for Internet Explorer conditional comments. E.g. "IE 7".JavaScriptContentHeaderItem
for the given content.public static JavaScriptUrlReferenceHeaderItem forUrl(String url)
JavaScriptUrlReferenceHeaderItem
for the given url.url
- context-relative url of the the javascript resourceJavaScriptUrlReferenceHeaderItem
for the given url.public static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id)
JavaScriptUrlReferenceHeaderItem
for the given url.url
- context-relative url of the the javascript resourceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)JavaScriptUrlReferenceHeaderItem
for the given url.public static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id, boolean defer)
JavaScriptUrlReferenceHeaderItem
for the given url.url
- context-relative url of the the javascript resourceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.JavaScriptUrlReferenceHeaderItem
for the given url.public static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id, boolean defer, String charset)
JavaScriptUrlReferenceHeaderItem
for the given url.url
- context-relative url of the the javascript resourceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.charset
- a non null value specifies the charset attribute of the script tagJavaScriptUrlReferenceHeaderItem
for the given url.public static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id, boolean defer, String charset, String condition)
JavaScriptUrlReferenceHeaderItem
for the given url.url
- context-relative url of the the javascript resourceid
- id that will be used to filter duplicate reference (it's still filtered by URL
too)defer
- specifies that the execution of a script should be deferred (delayed) until after
the page has been loaded.charset
- a non null value specifies the charset attribute of the script tagJavaScriptUrlReferenceHeaderItem
for the given url.protected final void internalRenderJavaScriptReference(Response response, String url, String id, boolean defer, String charset, String condition, boolean async)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.