KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > guice > InternalAjaxFilter


1 /*
2  * Copyright 2007 Tim Peierls
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.directwebremoting.guice;
17
18 import com.google.inject.Provider;
19
20 import java.lang.reflect.Method JavaDoc;
21
22 import org.directwebremoting.AjaxFilter;
23 import org.directwebremoting.AjaxFilterChain;
24 import org.directwebremoting.extend.AjaxFilterManager;
25
26 /**
27  * Specialized Ajax filter implementation that uses a Provider to
28  * look up instances to delegate to. This class is used by
29  * {@link InternalAjaxFilterManager}.
30  * @author Tim Peierls [tim at peierls dot net]
31  */

32 class InternalAjaxFilter implements AjaxFilter
33 {
34     InternalAjaxFilter(Provider<AjaxFilter> provider)
35     {
36         this.provider = provider;
37     }
38
39     public Object JavaDoc doFilter(Object JavaDoc obj, Method JavaDoc method, Object JavaDoc[] params, AjaxFilterChain chain)
40         throws Exception JavaDoc
41     {
42         return provider.get().doFilter(obj, method, params, chain);
43     }
44     
45     private final Provider<AjaxFilter> provider;
46 }
47
Popular Tags