001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.shiro.web.filter.mgt; 020 021import javax.servlet.FilterChain; 022import javax.servlet.ServletRequest; 023import javax.servlet.ServletResponse; 024 025/** 026 * A {@code FilterChainResolver} can resolve an appropriate {@link FilterChain} to execute during a 027 * {@code ServletRequest}. It allows resolution of arbitrary filter chains which can be executed for any given 028 * request or URI/URL. 029 * <p/> 030 * This mechanism allows for a much more flexible FilterChain resolution than normal {@code web.xml} servlet filter 031 * definitions: it allows arbitrary filter chains to be defined per URL in a much more concise and easy to read manner, 032 * and even allows filter chains to be dynamically resolved or constructed at runtime if the underlying implementation 033 * supports it. 034 * 035 * @since 1.0 036 */ 037public interface FilterChainResolver { 038 039 /** 040 * Returns the filter chain that should be executed for the given request, or {@code null} if the 041 * original chain should be used. 042 * <p/> 043 * This method allows a implementation to define arbitrary security {@link javax.servlet.Filter Filter} 044 * chains for any given request or URL pattern. 045 * 046 * @param request the incoming ServletRequest 047 * @param response the outgoing ServletResponse 048 * @param originalChain the original {@code FilterChain} intercepted by the ShiroFilter implementation. 049 * @return the filter chain that should be executed for the given request, or {@code null} if the 050 * original chain should be used. 051 */ 052 FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain); 053 054}