Class HeaderResponse
- java.lang.Object
-
- org.apache.wicket.markup.head.internal.HeaderResponse
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IHeaderResponse
public abstract class HeaderResponse extends Object implements IHeaderResponse
Default implementation of theIHeaderResponse
interface.- Author:
- Matej Knopp, Igor Vaynberg (ivaynberg)
-
-
Constructor Summary
Constructors Constructor Description HeaderResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Mark Header rendering is completed and subsequent usage will be ignored.protected abstract Response
getRealResponse()
Once the HeaderResponse is closed, no output may be written to it anymore.Response
getResponse()
Returns the response that can be used to write arbitrary text to the head section.boolean
isClosed()
protected void
markItemRendered(HeaderItem item)
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.protected boolean
wasItemRendered(HeaderItem item)
boolean
wasRendered(Object object)
Returns whether the given object has been marked as rendered.
-
-
-
Constructor Detail
-
HeaderResponse
public HeaderResponse()
-
-
Method Detail
-
markRendered
public void markRendered(Object object)
Description copied from interface:IHeaderResponse
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).- Specified by:
markRendered
in interfaceIHeaderResponse
- Parameters:
object
- object to be marked as rendered.- See Also:
IHeaderResponse.markRendered(java.lang.Object)
-
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
- Parameters:
item
- The item to render.- See Also:
IHeaderResponse.markRendered(Object)
-
wasItemRendered
protected boolean wasItemRendered(HeaderItem item)
-
markItemRendered
protected void markItemRendered(HeaderItem item)
-
wasRendered
public boolean wasRendered(Object object)
Description copied from interface:IHeaderResponse
Returns whether the given object has been marked as rendered.- Specified by:
wasRendered
in interfaceIHeaderResponse
- Parameters:
object
- Object that is queried to be rendered- Returns:
- Whether the object has been marked as rendered during the request
- See Also:
IHeaderResponse.wasRendered(java.lang.Object)
-
close
public void close()
Description copied from interface:IHeaderResponse
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
- Specified by:
close
in interfaceIHeaderResponse
- See Also:
IHeaderResponse.close()
-
getResponse
public final Response getResponse()
Description copied from interface:IHeaderResponse
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.
- Specified by:
getResponse
in interfaceIHeaderResponse
- Returns:
- Response
- See Also:
IHeaderResponse.getResponse()
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceIHeaderResponse
- Returns:
- if header rendering is completed and subsequent usage will be ignored
- See Also:
IHeaderResponse.isClosed()
-
getRealResponse
protected abstract Response getRealResponse()
Once the HeaderResponse is closed, no output may be written to it anymore. To enforce that, thegetResponse()
is defined final in this class and will return a NullResponse instance once closed or otherwise the Response provided by this method.- Returns:
- Response
-
-