Package org.apache.wicket.markup.head
Interface IHeaderResponse
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
CSPNonceHeaderResponseDecorator
,DecoratingHeaderResponse
,FilteringHeaderResponse
,HeaderResponse
,JavaScriptDeferHeaderResponse
,JavaScriptFilteredIntoFooterHeaderResponse
,ResourceAggregator
,SubresourceHeaderResponse
public interface IHeaderResponse extends Closeable
Interface that is used to render header elements (usually javascript and CSS references). Implementation of this interface is responsible for filtering duplicate contributions (so that for example the same javascript is not loaded twice) during the same request.- Author:
- Matej Knopp
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Mark Header rendering is completed and subsequent usage will be ignored.Response
getResponse()
Returns the response that can be used to write arbitrary text to the head section.boolean
isClosed()
void
markRendered(Object object)
Marks the given object as rendered.void
render(HeaderItem item)
Renders the givenHeaderItem
to the response if none of its tokens has been rendered before.boolean
wasRendered(Object object)
Returns whether the given object has been marked as rendered.
-
-
-
Method Detail
-
render
void render(HeaderItem item)
Renders the givenHeaderItem
to the response if none of its tokens has been rendered before.Automatically marks all item's tokens as rendered.
- Parameters:
item
- The item to render.- See Also:
markRendered(Object)
-
markRendered
void markRendered(Object object)
Marks the given object as rendered. The object can be anything (string, resource reference, etc...). The purpose of this function is to allow user to manually keep track of rendered items. This can be useful for items that are expensive to generate (like interpolated text).- Parameters:
object
- object to be marked as rendered.
-
wasRendered
boolean wasRendered(Object object)
Returns whether the given object has been marked as rendered.- Parameters:
object
- Object that is queried to be rendered- Returns:
- Whether the object has been marked as rendered during the request
- See Also:
markRendered(Object)
-
getResponse
Response getResponse()
Returns the response that can be used to write arbitrary text to the head section.Note: This method is kind of dangerous as users are able to write to the output whatever they like.
- Returns:
- Response
-
close
void close()
Mark Header rendering is completed and subsequent usage will be ignored. If some kind of buffering is used internally, this action will mark that the contents has to be flushed out.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
isClosed
boolean isClosed()
- Returns:
- if header rendering is completed and subsequent usage will be ignored
-
-