Moved o.a.w.resource.filtering to o.a.w.markup.head.filter, shortening some classnames
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/8cf310d9 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/8cf310d9 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/8cf310d9 Branch: refs/heads/master Commit: 8cf310d9507ee1b606135b01cd514277a18df5d7 Parents: 23e81bf Author: Emond Papegaaij <[email protected]> Authored: Mon Jan 9 18:02:33 2012 +0100 Committer: Emond Papegaaij <[email protected]> Committed: Tue Jan 10 09:31:01 2012 +0100 ---------------------------------------------------------------------- .../head/filter/AbstractHeaderResponseFilter.java | 56 ++++ .../filter/CssAcceptingHeaderResponseFilter.java | 53 ++++ .../head/filter/FilteringHeaderResponse.java | 229 +++++++++++++++ .../head/filter/HeaderResponseContainer.java | 73 +++++ .../JavaScriptAcceptingHeaderResponseFilter.java | 38 +++ ...JavaScriptFilteredIntoFooterHeaderResponse.java | 66 ++++ .../head/filter/OppositeHeaderResponseFilter.java | 60 ++++ .../filtering/AbstractHeaderResponseFilter.java | 56 ---- .../CssAcceptingHeaderResponseFilter.java | 53 ---- ...erResponseContainerFilteringHeaderResponse.java | 228 -------------- .../HeaderResponseFilteredResponseContainer.java | 73 ----- .../JavaScriptAcceptingHeaderResponseFilter.java | 38 --- ...JavaScriptFilteredIntoFooterHeaderResponse.java | 67 ----- .../filtering/OppositeHeaderResponseFilter.java | 60 ---- .../examples/resourcedecoration/HomePage.java | 4 +- .../ResourceDecorationApplication.java | 2 +- 16 files changed, 578 insertions(+), 578 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/AbstractHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/AbstractHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/AbstractHeaderResponseFilter.java new file mode 100644 index 0000000..03d9744 --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/AbstractHeaderResponseFilter.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +import org.apache.wicket.markup.head.HeaderItem; +import org.apache.wicket.markup.head.filter.FilteringHeaderResponse.IHeaderResponseFilter; + +/** + * A default implementation of IHeaderResponseFilter that returns true for everything. It is defined + * as abstract because you are not supposed to use it directly, but use it as a base and override + * any methods that you need to return something other than true from (whether that's always false + * or conditional logic). + * + * @author Jeremy Thomerson + */ +public abstract class AbstractHeaderResponseFilter implements IHeaderResponseFilter +{ + + private final String name; + + /** + * Create a response filter. + * + * @param name + */ + public AbstractHeaderResponseFilter(String name) + { + this.name = name; + } + + @Override + public String getName() + { + return name; + } + + @Override + public boolean accepts(HeaderItem item) + { + return true; + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/CssAcceptingHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/CssAcceptingHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/CssAcceptingHeaderResponseFilter.java new file mode 100644 index 0000000..a265007 --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/CssAcceptingHeaderResponseFilter.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +import org.apache.wicket.markup.head.CssHeaderItem; +import org.apache.wicket.markup.head.HeaderItem; + +/** + * This filter accepts anything that appears to be CSS. All CSS that is not a resource reference ( + * {@link #acceptOtherCss()}) is accepted. All JS that is not a resource reference ( + * {@link #acceptOtherJavaScript()}) is not accepted. + * + * The references are accepted if they appear to be CSS. If the reference passed in is an instance + * of {@link AbstractResourceDependentResourceReference}, we use the {@link ResourceType} from it to + * determine if it is CSS. Otherwise, we see if the ResourceReference.name property ends with + * ".css". + * + * @author Jeremy Thomerson + */ +public class CssAcceptingHeaderResponseFilter extends AbstractHeaderResponseFilter +{ + + /** + * Construct. + * + * @param name + * name of the filter (used by the container that renders these resources) + */ + public CssAcceptingHeaderResponseFilter(String name) + { + super(name); + } + + @Override + public boolean accepts(HeaderItem item) + { + return item instanceof CssHeaderItem; + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/FilteringHeaderResponse.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/FilteringHeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/FilteringHeaderResponse.java new file mode 100644 index 0000000..b4cb856 --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/FilteringHeaderResponse.java @@ -0,0 +1,229 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.wicket.Application; +import org.apache.wicket.MetaDataKey; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.head.HeaderItem; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.ResourceAggregator; +import org.apache.wicket.markup.head.internal.HeaderResponse; +import org.apache.wicket.markup.html.DecoratingHeaderResponse; +import org.apache.wicket.request.Response; +import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.response.StringResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 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. + * + * @see HeaderResponseContainer + * @see CssAcceptingHeaderResponseFilter + * @see JavaScriptAcceptingHeaderResponseFilter + * @author Jeremy Thomerson + * @author Emond Papegaaij + */ +public class FilteringHeaderResponse extends DecoratingHeaderResponse +{ + + private static final Logger log = LoggerFactory.getLogger(FilteringHeaderResponse.class); + + /** + * A filter used to bucket your resources, inline scripts, etc, into different responses. The + * bucketed resources are then rendered by a {@link HeaderResponseContainer}, using the name of + * the filter to get the correct bucket. + * + * @author Jeremy Thomerson + */ + public static interface IHeaderResponseFilter + { + /** + * @return name of the filter (used by the container that renders these resources) + */ + String getName(); + + /** + * Determines whether a given HeaderItem should be rendered in the bucket represented by + * this filter. + * + * @param item + * the item to be rendered + * @return true if it should be bucketed with other things in this filter + */ + boolean accepts(HeaderItem item); + } + + /** + * we store this HeaderResponseContainerFilteringHeaderResponse in the RequestCycle so that the + * containers can access it to render their bucket of stuff + */ + private static final MetaDataKey<FilteringHeaderResponse> RESPONSE_KEY = new MetaDataKey<FilteringHeaderResponse>() + { + private static final long serialVersionUID = 1L; + }; + + private final Map<String, List<HeaderItem>> responseFilterMap = new HashMap<String, List<HeaderItem>>(); + private IHeaderResponseFilter[] filters; + private final String headerFilterName; + + /** + * Construct. + * + * @param response + * the wrapped IHeaderResponse + * @param headerFilterName + * the name that the filter for things that should appear in the head (default Wicket + * location) uses + * @param filters + * 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 headerFilterName + */ + public FilteringHeaderResponse(IHeaderResponse response, String headerFilterName, + IHeaderResponseFilter[] filters) + { + super(response); + this.headerFilterName = headerFilterName; + + setFilters(filters); + + RequestCycle.get().setMetaData(RESPONSE_KEY, this); + } + + protected void setFilters(IHeaderResponseFilter[] filters) + { + this.filters = filters; + if (filters == null) + { + return; + } + for (IHeaderResponseFilter filter : filters) + { + responseFilterMap.put(filter.getName(), new ArrayList<HeaderItem>()); + } + } + + /** + * @return the HeaderResponseContainerFilteringHeaderResponse being used in this RequestCycle + */ + public static FilteringHeaderResponse get() + { + RequestCycle requestCycle = RequestCycle.get(); + if (requestCycle == null) + { + throw new IllegalStateException( + "You can only get the HeaderResponseContainerFilteringHeaderResponse when there is a RequestCycle present"); + } + FilteringHeaderResponse response = requestCycle.getMetaData(RESPONSE_KEY); + if (response == null) + { + throw new IllegalStateException( + "No HeaderResponseContainerFilteringHeaderResponse is present in the request cycle. This may mean that you have not decorated the header response with a HeaderResponseContainerFilteringHeaderResponse. Simply calling the HeaderResponseContainerFilteringHeaderResponse constructor sets itself on the request cycle"); + } + return response; + } + + @Override + public void render(HeaderItem item) + { + for (IHeaderResponseFilter filter : filters) + { + if (filter.accepts(item)) + { + render(item, filter); + return; + } + } + log.warn( + "A HeaderItem '{}' was rendered to the filtering header response, but did not match any filters, so it was effectively lost. Make sure that you have filters that accept every possible case or else configure a default filter that returns true to all acceptance tests", + item); + } + + @Override + public void close() + { + // write the stuff that was actually supposed to be in the header to the + // response, which is used by the built-in HtmlHeaderContainer to get + // its contents + CharSequence headerContent = getContent(headerFilterName); + RequestCycle.get().getResponse().write(headerContent); + // must make sure our super (and with it, the wrapped response) get closed: + super.close(); + } + + /** + * Gets the content that was rendered to this header response and matched the filter with the + * given name. + * + * @param filterName + * the name of the filter to get the bucket for + * @return the content that was accepted by the filter with this name + */ + public final CharSequence getContent(String filterName) + { + if (filterName == null || !responseFilterMap.containsKey(filterName)) + { + return ""; + } + List<HeaderItem> resp = responseFilterMap.get(filterName); + final StringResponse strResponse = new StringResponse(); + IHeaderResponse headerRenderer = new HeaderResponse() + { + @Override + protected Response getRealResponse() + { + return strResponse; + } + }; + + if (Application.get().getResourceSettings().getUseDefaultResourceAggregator()) + headerRenderer = new ResourceAggregator(headerRenderer); + + for (HeaderItem curItem : resp) + { + headerRenderer.render(curItem); + } + headerRenderer.close(); + return strResponse.getBuffer(); + } + + private void render(HeaderItem item, IHeaderResponseFilter filter) + { + render(item, responseFilterMap.get(filter.getName())); + } + + protected void render(HeaderItem item, List<HeaderItem> filteredItems) + { + if (AjaxRequestTarget.get() != null) + { + // we're in an ajax request, so we don't filter and separate stuff.... + getRealResponse().render(item); + return; + } + filteredItems.add(item); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/HeaderResponseContainer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/HeaderResponseContainer.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/HeaderResponseContainer.java new file mode 100644 index 0000000..de0cfef --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/HeaderResponseContainer.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.MarkupStream; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.parser.XmlTag.TagType; + +/** + * A container that renders the content that was bucketed into a certain bucket by + * {@link FilteringHeaderResponse}. + * + * Note that this container renders only its body by default. + * + * @author Jeremy Thomerson + */ +public class HeaderResponseContainer extends WebMarkupContainer +{ + private static final long serialVersionUID = 1L; + + private final String filterName; + + /** + * Construct. + * + * @param id + * the wicket id for this container + * @param filterName + * the name of the filter that is bucketing stuff to be rendered in this container + */ + public HeaderResponseContainer(String id, String filterName) + { + super(id); + this.filterName = filterName; + setRenderBodyOnly(true); + } + + @Override + protected void onComponentTag(ComponentTag tag) + { + super.onComponentTag(tag); + // force this into an open-close tag rather than a self-closing tag + tag.setType(TagType.OPEN); + } + + @Override + public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) + { + FilteringHeaderResponse response = FilteringHeaderResponse.get(); + if (!response.isClosed()) + { + throw new RuntimeException( + "there was an error processing the header response - you tried to render a bucket of response from HeaderResponseContainerFilteringHeaderResponse, but it had not yet run and been closed. this should occur when the header container that is standard in wicket renders, so perhaps you have done something to keep that from rendering?"); + } + CharSequence foot = response.getContent(filterName); + replaceComponentTagBody(markupStream, openTag, foot); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptAcceptingHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptAcceptingHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptAcceptingHeaderResponseFilter.java new file mode 100644 index 0000000..a43c45e --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptAcceptingHeaderResponseFilter.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +/** + * This filter returns the opposite of what {@link CssAcceptingHeaderResponseFilter} returns. + * + * @see CssAcceptingHeaderResponseFilter + * @author Jeremy Thomerson + */ +public class JavaScriptAcceptingHeaderResponseFilter extends OppositeHeaderResponseFilter +{ + /** + * Construct. + * + * @param name + * name of the filter (used by the container that renders these resources) + */ + public JavaScriptAcceptingHeaderResponseFilter(String name) + { + super(name, new CssAcceptingHeaderResponseFilter("NOT_USED")); + } + +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptFilteredIntoFooterHeaderResponse.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptFilteredIntoFooterHeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptFilteredIntoFooterHeaderResponse.java new file mode 100644 index 0000000..71343ce --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/JavaScriptFilteredIntoFooterHeaderResponse.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +import org.apache.wicket.markup.head.IHeaderResponse; + +/** + * A header response that creates two buckets. The header bucket will contain all references to CSS. + * The other bucket will contain all JavaScript, and you will need to add a + * {@link HeaderResponseContainer} to the footer of your page (typically just before the end body + * tag) to render the JavaScript. + * + * @author Jeremy Thomerson + */ +public final class JavaScriptFilteredIntoFooterHeaderResponse extends FilteringHeaderResponse +{ + private static final String HEADER_FILTER_NAME = "headerBucket"; + + /** + * Construct. + * + * @param response + * the response you are wrapping + * @param footerBucketName + * the name of the bucket that you will use for your footer container (see the class + * javadocs for a reminder about putting this container in your footer) + */ + public JavaScriptFilteredIntoFooterHeaderResponse(IHeaderResponse response, + String footerBucketName) + { + super(response, HEADER_FILTER_NAME, null); + setFilters(createFilters(footerBucketName)); + } + + protected IHeaderResponseFilter[] createFilters(String footerBucketName) + { + IHeaderResponseFilter header = createHeaderFilter(HEADER_FILTER_NAME); + IHeaderResponseFilter footer = createFooterFilter(footerBucketName); + return new IHeaderResponseFilter[] { header, footer }; + } + + protected JavaScriptAcceptingHeaderResponseFilter createFooterFilter(String footerBucketName) + { + return new JavaScriptAcceptingHeaderResponseFilter(footerBucketName); + } + + protected CssAcceptingHeaderResponseFilter createHeaderFilter(String headerFilterName) + { + return new CssAcceptingHeaderResponseFilter(HEADER_FILTER_NAME); + } + +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/OppositeHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/OppositeHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/OppositeHeaderResponseFilter.java new file mode 100644 index 0000000..1cabb0a --- /dev/null +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/OppositeHeaderResponseFilter.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.head.filter; + +import org.apache.wicket.markup.head.HeaderItem; +import org.apache.wicket.markup.head.filter.FilteringHeaderResponse.IHeaderResponseFilter; + +/** + * A filter that takes another filter and always returns the opposite of another filter. This is + * useful where you have two filters (i.e. one for header and one for footer) and want to ensure + * that nothing ever has false returned for both cases. + * + * @author Jeremy Thomerson + */ +public class OppositeHeaderResponseFilter implements IHeaderResponseFilter +{ + + private final String name; + private final IHeaderResponseFilter other; + + /** + * Construct. + * + * @param name + * the name used by this filter for its bucket o' stuff + * @param other + * the other filter to return the opposite of + */ + public OppositeHeaderResponseFilter(String name, IHeaderResponseFilter other) + { + this.name = name; + this.other = other; + } + + @Override + public String getName() + { + return name; + } + + @Override + public boolean accepts(HeaderItem item) + { + return !other.accepts(item); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/AbstractHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/AbstractHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/AbstractHeaderResponseFilter.java deleted file mode 100644 index 8251458..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/AbstractHeaderResponseFilter.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -import org.apache.wicket.markup.head.HeaderItem; -import org.apache.wicket.resource.filtering.HeaderResponseContainerFilteringHeaderResponse.IHeaderResponseFilter; - -/** - * A default implementation of IHeaderResponseFilter that returns true for everything. It is defined - * as abstract because you are not supposed to use it directly, but use it as a base and override - * any methods that you need to return something other than true from (whether that's always false - * or conditional logic). - * - * @author Jeremy Thomerson - */ -public abstract class AbstractHeaderResponseFilter implements IHeaderResponseFilter -{ - - private final String name; - - /** - * Create a response filter. - * - * @param name - */ - public AbstractHeaderResponseFilter(String name) - { - this.name = name; - } - - @Override - public String getName() - { - return name; - } - - @Override - public boolean accepts(HeaderItem item) - { - return true; - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/CssAcceptingHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/CssAcceptingHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/CssAcceptingHeaderResponseFilter.java deleted file mode 100644 index 1b75000..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/CssAcceptingHeaderResponseFilter.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -import org.apache.wicket.markup.head.CssHeaderItem; -import org.apache.wicket.markup.head.HeaderItem; - -/** - * This filter accepts anything that appears to be CSS. All CSS that is not a resource reference ( - * {@link #acceptOtherCss()}) is accepted. All JS that is not a resource reference ( - * {@link #acceptOtherJavaScript()}) is not accepted. - * - * The references are accepted if they appear to be CSS. If the reference passed in is an instance - * of {@link AbstractResourceDependentResourceReference}, we use the {@link ResourceType} from it to - * determine if it is CSS. Otherwise, we see if the ResourceReference.name property ends with - * ".css". - * - * @author Jeremy Thomerson - */ -public class CssAcceptingHeaderResponseFilter extends AbstractHeaderResponseFilter -{ - - /** - * Construct. - * - * @param name - * name of the filter (used by the container that renders these resources) - */ - public CssAcceptingHeaderResponseFilter(String name) - { - super(name); - } - - @Override - public boolean accepts(HeaderItem item) - { - return item instanceof CssHeaderItem; - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseContainerFilteringHeaderResponse.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseContainerFilteringHeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseContainerFilteringHeaderResponse.java deleted file mode 100644 index c869b3a..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseContainerFilteringHeaderResponse.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.wicket.Application; -import org.apache.wicket.MetaDataKey; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.head.HeaderItem; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.html.DecoratingHeaderResponse; -import org.apache.wicket.markup.head.internal.HeaderResponse; -import org.apache.wicket.request.Response; -import org.apache.wicket.request.cycle.RequestCycle; -import org.apache.wicket.markup.head.ResourceAggregator; -import org.apache.wicket.response.StringResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 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. - * - * @see HeaderResponseFilteredResponseContainer - * @see CssAcceptingHeaderResponseFilter - * @see JavaScriptAcceptingHeaderResponseFilter - * @author Jeremy Thomerson - */ -public class HeaderResponseContainerFilteringHeaderResponse extends DecoratingHeaderResponse -{ - - private static final Logger log = LoggerFactory.getLogger(HeaderResponseContainerFilteringHeaderResponse.class); - - /** - * A filter used to bucket your resources, inline scripts, etc, into different responses. The - * bucketed resources are then rendered by a {@link HeaderResponseFilteredResponseContainer}, - * using the name of the filter to get the correct bucket. - * - * @author Jeremy Thomerson - */ - public static interface IHeaderResponseFilter - { - /** - * @return name of the filter (used by the container that renders these resources) - */ - String getName(); - - /** - * Determines whether a given HeaderItem should be rendered in the bucket represented by - * this filter. - * - * @param item - * the item to be rendered - * @return true if it should be bucketed with other things in this filter - */ - boolean accepts(HeaderItem item); - } - - /** - * we store this HeaderResponseContainerFilteringHeaderResponse in the RequestCycle so that the - * containers can access it to render their bucket of stuff - */ - private static final MetaDataKey<HeaderResponseContainerFilteringHeaderResponse> RESPONSE_KEY = new MetaDataKey<HeaderResponseContainerFilteringHeaderResponse>() - { - private static final long serialVersionUID = 1L; - }; - - private final Map<String, List<HeaderItem>> responseFilterMap = new HashMap<String, List<HeaderItem>>(); - private IHeaderResponseFilter[] filters; - private final String headerFilterName; - - /** - * Construct. - * - * @param response - * the wrapped IHeaderResponse - * @param headerFilterName - * the name that the filter for things that should appear in the head (default Wicket - * location) uses - * @param filters - * 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 headerFilterName - */ - public HeaderResponseContainerFilteringHeaderResponse(IHeaderResponse response, - String headerFilterName, IHeaderResponseFilter[] filters) - { - super(response); - this.headerFilterName = headerFilterName; - - setFilters(filters); - - RequestCycle.get().setMetaData(RESPONSE_KEY, this); - } - - protected void setFilters(IHeaderResponseFilter[] filters) - { - this.filters = filters; - if (filters == null) - { - return; - } - for (IHeaderResponseFilter filter : filters) - { - responseFilterMap.put(filter.getName(), new ArrayList<HeaderItem>()); - } - } - - /** - * @return the HeaderResponseContainerFilteringHeaderResponse being used in this RequestCycle - */ - public static HeaderResponseContainerFilteringHeaderResponse get() - { - RequestCycle requestCycle = RequestCycle.get(); - if (requestCycle == null) - { - throw new IllegalStateException( - "You can only get the HeaderResponseContainerFilteringHeaderResponse when there is a RequestCycle present"); - } - HeaderResponseContainerFilteringHeaderResponse response = requestCycle.getMetaData(RESPONSE_KEY); - if (response == null) - { - throw new IllegalStateException( - "No HeaderResponseContainerFilteringHeaderResponse is present in the request cycle. This may mean that you have not decorated the header response with a HeaderResponseContainerFilteringHeaderResponse. Simply calling the HeaderResponseContainerFilteringHeaderResponse constructor sets itself on the request cycle"); - } - return response; - } - - @Override - public void render(HeaderItem item) - { - for (IHeaderResponseFilter filter : filters) - { - if (filter.accepts(item)) - { - render(item, filter); - return; - } - } - log.warn( - "A HeaderItem '{}' was rendered to the filtering header response, but did not match any filters, so it was effectively lost. Make sure that you have filters that accept every possible case or else configure a default filter that returns true to all acceptance tests", - item); - } - - @Override - public void close() - { - // write the stuff that was actually supposed to be in the header to the - // response, which is used by the built-in HtmlHeaderContainer to get - // its contents - CharSequence headerContent = getContent(headerFilterName); - RequestCycle.get().getResponse().write(headerContent); - // must make sure our super (and with it, the wrapped response) get closed: - super.close(); - } - - /** - * Gets the content that was rendered to this header response and matched the filter with the - * given name. - * - * @param filterName - * the name of the filter to get the bucket for - * @return the content that was accepted by the filter with this name - */ - public final CharSequence getContent(String filterName) - { - if (filterName == null || !responseFilterMap.containsKey(filterName)) - { - return ""; - } - List<HeaderItem> resp = responseFilterMap.get(filterName); - final StringResponse strResponse = new StringResponse(); - IHeaderResponse headerRenderer = new HeaderResponse() - { - @Override - protected Response getRealResponse() - { - return strResponse; - } - }; - - if (Application.get().getResourceSettings().getUseDefaultResourceAggregator()) - headerRenderer = new ResourceAggregator(headerRenderer); - - for (HeaderItem curItem : resp) - { - headerRenderer.render(curItem); - } - headerRenderer.close(); - return strResponse.getBuffer(); - } - - private void render(HeaderItem item, IHeaderResponseFilter filter) - { - render(item, responseFilterMap.get(filter.getName())); - } - - protected void render(HeaderItem item, List<HeaderItem> filteredItems) - { - if (AjaxRequestTarget.get() != null) - { - // we're in an ajax request, so we don't filter and separate stuff.... - getRealResponse().render(item); - return; - } - filteredItems.add(item); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseFilteredResponseContainer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseFilteredResponseContainer.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseFilteredResponseContainer.java deleted file mode 100644 index 46b4ea9..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/HeaderResponseFilteredResponseContainer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.MarkupStream; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.parser.XmlTag.TagType; - -/** - * A container that renders the content that was bucketed into a certain bucket by - * {@link HeaderResponseContainerFilteringHeaderResponse}. - * - * Note that this container renders only its body by default. - * - * @author Jeremy Thomerson - */ -public class HeaderResponseFilteredResponseContainer extends WebMarkupContainer -{ - private static final long serialVersionUID = 1L; - - private final String filterName; - - /** - * Construct. - * - * @param id - * the wicket id for this container - * @param filterName - * the name of the filter that is bucketing stuff to be rendered in this container - */ - public HeaderResponseFilteredResponseContainer(String id, String filterName) - { - super(id); - this.filterName = filterName; - setRenderBodyOnly(true); - } - - @Override - protected void onComponentTag(ComponentTag tag) - { - super.onComponentTag(tag); - // force this into an open-close tag rather than a self-closing tag - tag.setType(TagType.OPEN); - } - - @Override - public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) - { - HeaderResponseContainerFilteringHeaderResponse response = HeaderResponseContainerFilteringHeaderResponse.get(); - if (!response.isClosed()) - { - throw new RuntimeException( - "there was an error processing the header response - you tried to render a bucket of response from HeaderResponseContainerFilteringHeaderResponse, but it had not yet run and been closed. this should occur when the header container that is standard in wicket renders, so perhaps you have done something to keep that from rendering?"); - } - CharSequence foot = response.getContent(filterName); - replaceComponentTagBody(markupStream, openTag, foot); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptAcceptingHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptAcceptingHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptAcceptingHeaderResponseFilter.java deleted file mode 100644 index 1417441..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptAcceptingHeaderResponseFilter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -/** - * This filter returns the opposite of what {@link CssAcceptingHeaderResponseFilter} returns. - * - * @see CssAcceptingHeaderResponseFilter - * @author Jeremy Thomerson - */ -public class JavaScriptAcceptingHeaderResponseFilter extends OppositeHeaderResponseFilter -{ - /** - * Construct. - * - * @param name - * name of the filter (used by the container that renders these resources) - */ - public JavaScriptAcceptingHeaderResponseFilter(String name) - { - super(name, new CssAcceptingHeaderResponseFilter("NOT_USED")); - } - -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptFilteredIntoFooterHeaderResponse.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptFilteredIntoFooterHeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptFilteredIntoFooterHeaderResponse.java deleted file mode 100644 index bbb0e10..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/JavaScriptFilteredIntoFooterHeaderResponse.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -import org.apache.wicket.markup.head.IHeaderResponse; - -/** - * A header response that creates two buckets. The header bucket will contain all references to CSS. - * The other bucket will contain all JavaScript, and you will need to add a - * HeaderResponseFilteredResponseContainer to the footer of your page (typically just before the end - * body tag) to render the JavaScript. - * - * @author Jeremy Thomerson - */ -public final class JavaScriptFilteredIntoFooterHeaderResponse extends - HeaderResponseContainerFilteringHeaderResponse -{ - private static final String HEADER_FILTER_NAME = "headerBucket"; - - /** - * Construct. - * - * @param response - * the response you are wrapping - * @param footerBucketName - * the name of the bucket that you will use for your footer container (see the class - * javadocs for a reminder about putting this container in your footer) - */ - public JavaScriptFilteredIntoFooterHeaderResponse(IHeaderResponse response, - String footerBucketName) - { - super(response, HEADER_FILTER_NAME, null); - setFilters(createFilters(footerBucketName)); - } - - protected IHeaderResponseFilter[] createFilters(String footerBucketName) - { - IHeaderResponseFilter header = createHeaderFilter(HEADER_FILTER_NAME); - IHeaderResponseFilter footer = createFooterFilter(footerBucketName); - return new IHeaderResponseFilter[] { header, footer }; - } - - protected JavaScriptAcceptingHeaderResponseFilter createFooterFilter(String footerBucketName) - { - return new JavaScriptAcceptingHeaderResponseFilter(footerBucketName); - } - - protected CssAcceptingHeaderResponseFilter createHeaderFilter(String headerFilterName) - { - return new CssAcceptingHeaderResponseFilter(HEADER_FILTER_NAME); - } - -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-core/src/main/java/org/apache/wicket/resource/filtering/OppositeHeaderResponseFilter.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/OppositeHeaderResponseFilter.java b/wicket-core/src/main/java/org/apache/wicket/resource/filtering/OppositeHeaderResponseFilter.java deleted file mode 100644 index ba968dd..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/resource/filtering/OppositeHeaderResponseFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.resource.filtering; - -import org.apache.wicket.markup.head.HeaderItem; -import org.apache.wicket.resource.filtering.HeaderResponseContainerFilteringHeaderResponse.IHeaderResponseFilter; - -/** - * A filter that takes another filter and always returns the opposite of another filter. This is - * useful where you have two filters (i.e. one for header and one for footer) and want to ensure - * that nothing ever has false returned for both cases. - * - * @author Jeremy Thomerson - */ -public class OppositeHeaderResponseFilter implements IHeaderResponseFilter -{ - - private final String name; - private final IHeaderResponseFilter other; - - /** - * Construct. - * - * @param name - * the name used by this filter for its bucket o' stuff - * @param other - * the other filter to return the opposite of - */ - public OppositeHeaderResponseFilter(String name, IHeaderResponseFilter other) - { - this.name = name; - this.other = other; - } - - @Override - public String getName() - { - return name; - } - - @Override - public boolean accepts(HeaderItem item) - { - return !other.accepts(item); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/HomePage.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/HomePage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/HomePage.java index 4b415d6..23212dc 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/HomePage.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/HomePage.java @@ -28,9 +28,9 @@ import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.request.resource.CssResourceReference; import org.apache.wicket.request.resource.PackageResourceReference; import org.apache.wicket.resource.JQueryPluginResourceReference; -import org.apache.wicket.resource.filtering.HeaderResponseFilteredResponseContainer; import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; +import org.apache.wicket.markup.head.filter.HeaderResponseContainer; import org.apache.wicket.util.time.Duration; /** @@ -84,7 +84,7 @@ public class HomePage extends WicketExamplePage * a container for all collected JavaScript contributions that will be loaded at the page * footer (after </body>) */ - add(new HeaderResponseFilteredResponseContainer("footerJS", "footerJS")); + add(new HeaderResponseContainer("footerJS", "footerJS")); } @Override http://git-wip-us.apache.org/repos/asf/wicket/blob/8cf310d9/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/ResourceDecorationApplication.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/ResourceDecorationApplication.java b/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/ResourceDecorationApplication.java index fe3c6af..0ee8177 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/ResourceDecorationApplication.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/resourcedecoration/ResourceDecorationApplication.java @@ -18,10 +18,10 @@ package org.apache.wicket.examples.resourcedecoration; import org.apache.wicket.Application; import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.filter.JavaScriptFilteredIntoFooterHeaderResponse; import org.apache.wicket.markup.html.IHeaderResponseDecorator; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.request.resource.CssResourceReference; -import org.apache.wicket.resource.filtering.JavaScriptFilteredIntoFooterHeaderResponse; /** * An application showing how to return several resources into a single http response.
