001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.markup.head.filter; 018 019import org.apache.wicket.markup.head.HeaderItem; 020import org.apache.wicket.markup.head.JavaScriptHeaderItem; 021import org.apache.wicket.markup.head.OnDomReadyHeaderItem; 022import org.apache.wicket.markup.head.OnEventHeaderItem; 023import org.apache.wicket.markup.head.OnLoadHeaderItem; 024 025/** 026 * This filter accepts all {@link JavaScriptHeaderItem}s. 027 * 028 * Note: this filter used to accept everything that is not css, it no longer does. For example, 029 * meta-tags are neither CSS nor JS. 030 * 031 * @author Jeremy Thomerson 032 * @author Emond Papegaaij 033 */ 034public class JavaScriptAcceptingHeaderResponseFilter extends AbstractHeaderResponseFilter 035{ 036 037 /** 038 * Construct. 039 * 040 * @param name 041 * name of the filter (used by the container that renders these resources) 042 */ 043 public JavaScriptAcceptingHeaderResponseFilter(String name) 044 { 045 super(name); 046 } 047 048 @Override 049 protected boolean acceptsWrapped(HeaderItem item) 050 { 051 return (item instanceof JavaScriptHeaderItem || 052 item instanceof OnDomReadyHeaderItem || 053 item instanceof OnLoadHeaderItem || 054 item instanceof OnEventHeaderItem 055 ); 056 } 057}