org.apache.wicket.markup.head
Interface IHeaderResponse

All Superinterfaces:
Closeable
All Known Implementing Classes:
DecoratingHeaderResponse, FilteringHeaderResponse, HeaderResponse, JavaScriptFilteredIntoFooterHeaderResponse, ResourceAggregator

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
 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 given HeaderItem to the response if none of the tokens of the item 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 given HeaderItem to the response if none of the tokens of the item has been rendered before.

Parameters:
item - The item to render.

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

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 interface Closeable

isClosed

boolean isClosed()
Returns:
if header rendering is completed and subsequent usage will be ignored


Copyright © 2006–2018 Apache Software Foundation. All rights reserved.