KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > getahead > dwrdemo > filter > LoggingAjaxFilter


1 /*
2  * Copyright 2005 Joe Walker
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.getahead.dwrdemo.filter;
17
18 import java.lang.reflect.Method JavaDoc;
19
20 import org.directwebremoting.AjaxFilter;
21 import org.directwebremoting.AjaxFilterChain;
22 import org.directwebremoting.util.Logger;
23
24
25 /**
26  * An example filter that does some logging of Ajax calls
27  * @author Joe Walker [joe at getahead dot ltd dot uk]
28  */

29 public class LoggingAjaxFilter implements AjaxFilter
30 {
31     /* (non-Javadoc)
32      * @see uk.ltd.getahead.dwr.AjaxFilter#doFilter(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], uk.ltd.getahead.dwr.AjaxFilterChain)
33      */

34     public Object JavaDoc doFilter(Object JavaDoc obj, Method JavaDoc method, Object JavaDoc[] params, AjaxFilterChain chain) throws Exception JavaDoc
35     {
36         log.debug("About to execute: " + method.getName() + "() on " + obj);
37         Object JavaDoc reply = chain.doFilter(obj, method, params);
38         log.debug("Executed: " + method.getName() + "() giving " + reply);
39         return reply;
40     }
41
42     /**
43      * The log stream
44      */

45     private static final Logger log = Logger.getLogger(LoggingAjaxFilter.class);
46 }
47
Popular Tags