|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.markup.html.DecoratingHeaderResponse org.apache.wicket.markup.head.filter.FilteringHeaderResponse
public class FilteringHeaderResponse
This header response allows you to separate things that are added to the IHeaderResponse into different buckets. Then, you can render those different buckets in separate areas of the page based on your filter logic. A typical use case for this header response is to move the loading of JavaScript files (and inline script tags) to the footer of the page.
HeaderResponseContainer
,
CssAcceptingHeaderResponseFilter
,
JavaScriptAcceptingHeaderResponseFilter
Nested Class Summary | |
---|---|
static interface |
FilteringHeaderResponse.IHeaderResponseFilter
A filter used to bucket your resources, inline scripts, etc, into different responses. |
Field Summary | |
---|---|
static String |
DEFAULT_HEADER_FILTER_NAME
The default name of the filter that will collect contributions which should be rendered in the page's <head> |
Constructor Summary | |
---|---|
FilteringHeaderResponse(IHeaderResponse response)
Constructor without explicit filters. |
|
FilteringHeaderResponse(IHeaderResponse response,
String headerFilterName,
Iterable<? extends FilteringHeaderResponse.IHeaderResponseFilter> filters)
Construct. |
Method Summary | |
---|---|
void |
close()
Mark Header rendering is completed and subsequent usage will be ignored. |
static FilteringHeaderResponse |
get()
|
CharSequence |
getContent(String filterName)
Gets the content that was rendered to this header response and matched the filter with the given name. |
void |
render(HeaderItem item)
Renders the given HeaderItem to the response if none of the
tokens of the item has been rendered before. |
protected void |
render(HeaderItem item,
List<HeaderItem> filteredItems)
|
protected void |
setFilters(Iterable<? extends FilteringHeaderResponse.IHeaderResponseFilter> filters)
|
Methods inherited from class org.apache.wicket.markup.html.DecoratingHeaderResponse |
---|
getRealResponse, getResponse, isClosed, markRendered, wasRendered |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_HEADER_FILTER_NAME
Constructor Detail |
---|
public FilteringHeaderResponse(IHeaderResponse response)
response
- the wrapped IHeaderResponseHeaderResponseContainer
public FilteringHeaderResponse(IHeaderResponse response, String headerFilterName, Iterable<? extends FilteringHeaderResponse.IHeaderResponseFilter> filters)
response
- the wrapped IHeaderResponseheaderFilterName
- the name that the filter for things that should appear in the head (default Wicket
location) usesfilters
- the filters to use to bucket things. There will be a bucket created for each
filter, by name. There should typically be at least one filter with the same name
as your headerFilterNameMethod Detail |
---|
protected void setFilters(Iterable<? extends FilteringHeaderResponse.IHeaderResponseFilter> filters)
public static FilteringHeaderResponse get()
public void render(HeaderItem item)
IHeaderResponse
HeaderItem
to the response if none of the
tokens of the item has been rendered before.
render
in interface IHeaderResponse
render
in class DecoratingHeaderResponse
item
- The item to render.public void close()
IHeaderResponse
close
in interface Closeable
close
in interface IHeaderResponse
close
in class DecoratingHeaderResponse
public final CharSequence getContent(String filterName)
filterName
- the name of the filter to get the bucket for
protected void render(HeaderItem item, List<HeaderItem> filteredItems)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |