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.response.filter; 018 019import org.apache.wicket.util.string.AppendingStringBuffer; 020 021/** 022 * A response filter can be added to the 023 * {@link org.apache.wicket.settings.RequestCycleSettings#addResponseFilter(IResponseFilter)} 024 * object. This will be called from the Buffered Response objects right before they would send it to 025 * the real responses. You have to use the 026 * {@link org.apache.wicket.settings.RequestCycleSettings#setBufferResponse(boolean)}(to true which 027 * is the default) for this filtering to work. 028 * 029 * @author jcompagner 030 * 031 * @see org.apache.wicket.settings.RequestCycleSettings#addResponseFilter(IResponseFilter) 032 */ 033@FunctionalInterface 034public interface IResponseFilter 035{ 036 /** 037 * Filters the response buffer and returns the filtered response that can be used in the next 038 * filter or returned to the real output itself. 039 * 040 * A filter may alter the response buffer and return the response buffer itself. 041 * 042 * @param responseBuffer 043 * The response buffer to be filtered 044 * @return The changed buffer or the response buffer itself (changed or not) 045 */ 046 AppendingStringBuffer filter(AppendingStringBuffer responseBuffer); 047}