KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > RequestListener


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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
17 package org.apache.cocoon;
18
19 import org.apache.avalon.framework.component.Component;
20 import org.apache.cocoon.environment.Environment;
21
22
23 /**
24  * This is called from with {@link Cocoon#process(Environment)}, before any
25  * requests are passed onto the {@link Processor} and after the request has been
26  * processed. It allows all requests to be logged or monitored.
27  * NB Cocoon does not require an instance of this Component to function, but if
28  * there is one it will be used.
29  */

30 public interface RequestListener extends Component {
31     String JavaDoc ROLE = RequestListener.class.getName();
32
33     /**
34      * <p>In this method you can call, for example:
35      * <code>Request req=ObjectModelHelper.getRequest(env.getObjectModel());</code>
36      * And then, you could use the following:
37      * <ul>
38      * <li>req.getRequestURI()</li>
39      * <li>req.getQueryString()</li>
40      * <li>req.getSession().getId()</li>
41      * <li>req.getLocale().getLanguage().toString()</li>
42      * </ul>
43      * <p>
44      * @param environment as supplied to {@link Processor#process(Environment)}
45      * from within {@link Cocoon#process(Environment)}.
46      */

47     public void onRequestStart(Environment environment);
48
49     /**
50      * <p>This method is called when a request has completed. This method is
51      * called before the response is committed.
52      * @param environment as supplied to {@link Processor#process(Environment)}
53      * from within {@link Cocoon#process(Environment)}.
54      */

55     public void onRequestEnd(Environment environment);
56     /**
57      * <p>This method is called when an exception has occurred processing the request.
58      * @param environment as supplied to {@link Processor#process(Environment)}
59      * from within {@link Cocoon#process(Environment)}.
60      * @param throwable the error that occurred processing the request.
61      */

62     public void onRequestException(Environment environment, Throwable JavaDoc throwable);
63 }
64
Popular Tags