Class JavaScriptDeferHeaderResponse
- java.lang.Object
-
- org.apache.wicket.markup.html.DecoratingHeaderResponse
-
- org.apache.wicket.markup.head.filter.JavaScriptDeferHeaderResponse
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IHeaderResponse
public class JavaScriptDeferHeaderResponse extends DecoratingHeaderResponse
A header response which defers allAbstractJavaScriptReferenceHeaderItem
s.To prevent any error because of possible dependencies to referenced JavaScript files *all*
JavaScriptHeaderItem
s are replaced with suitable implementations that delay any execution until all deferredAbstractJavaScriptReferenceHeaderItem
s have been loaded.Note: This solution depends on the execution order of JavaScript in the browser: The 'DOMContentLoaded' event has to be fired
after all deferred JavaScript resources have been loaded. This doesn't seem to be the case in all browsers, thus this class should be considered experimental. - Author:
- svenmeier +
-
-
Constructor Summary
Constructors Constructor Description JavaScriptDeferHeaderResponse(IHeaderResponse response)
Decorate the given response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
render(HeaderItem item)
Renders the givenHeaderItem
to the response if none of its tokens has been rendered before.-
Methods inherited from class org.apache.wicket.markup.html.DecoratingHeaderResponse
close, getRealResponse, getResponse, isClosed, markRendered, wasRendered
-
-
-
-
Constructor Detail
-
JavaScriptDeferHeaderResponse
public JavaScriptDeferHeaderResponse(IHeaderResponse response)
Decorate the given response.- Parameters:
response
-
-
-
Method Detail
-
render
public void render(HeaderItem item)
Description copied from interface:IHeaderResponse
Renders the givenHeaderItem
to the response if none of its tokens has been rendered before.Automatically marks all item's tokens as rendered.
- Specified by:
render
in interfaceIHeaderResponse
- Overrides:
render
in classDecoratingHeaderResponse
- Parameters:
item
- The item to render.- See Also:
IHeaderResponse.markRendered(Object)
-
-