KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > http > HttpHandler


1 // ========================================================================
2
// $Id: HttpHandler.java,v 1.11 2005/03/15 10:03:40 gregwilkins Exp $
3
// Copyright 199-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// ========================================================================
15

16 package org.mortbay.http;
17 import java.io.IOException JavaDoc;
18 import java.io.Serializable JavaDoc;
19
20 import org.mortbay.util.LifeCycle;
21
22
23 /* ------------------------------------------------------------ */
24 /** HTTP handler.
25  * The HTTP Handler interface is implemented by classes that wish to
26  * receive and handle requests from the HttpServer. The handle method
27  * is called for each request and the handler may ignore, modify or
28  * handle the request.
29  * Examples of HttpHandler instances include:<UL>
30  * <LI>org.mortbay.http.handler.ResourceHandler</LI>
31  * <LI>org.mortbay.jetty.servlet.ServletHandler</LI>
32  * </UL>
33  * @see org.mortbay.http.HttpServer
34  * @see org.mortbay.http.HttpContext
35  * @version $Id: HttpHandler.java,v 1.11 2005/03/15 10:03:40 gregwilkins Exp $
36  * @author Greg Wilkins (gregw)
37  */

38 public interface HttpHandler extends LifeCycle, Serializable JavaDoc
39 {
40     /* ------------------------------------------------------------ */
41     /** Get the name of the handler.
42      * @return The name of the handler used for logging and reporting.
43      */

44     public String JavaDoc getName();
45     
46     /* ------------------------------------------------------------ */
47     public HttpContext getHttpContext();
48
49     /* ------------------------------------------------------------ */
50     public void initialize(HttpContext context);
51     
52     /* ------------------------------------------------------------ */
53     /** Handle a request.
54      *
55      * Note that Handlers are tried in order until one has handled the
56      * request. i.e. until request.isHandled() returns true.
57      *
58      * In broad terms this means, either a response has been commited
59      * or request.setHandled(true) has been called.
60      *
61      * @param pathInContext The context path
62      * @param pathParams Path parameters such as encoded Session ID
63      * @param request The HttpRequest request
64      * @param response The HttpResponse response
65      */

66     public void handle(String JavaDoc pathInContext,
67                        String JavaDoc pathParams,
68                        HttpRequest request,
69                        HttpResponse response)
70         throws HttpException, IOException JavaDoc;
71 }
72
73
74
75
76
77
78
79
Popular Tags