01: //========================================================================
02: //$Id: Handler.java,v 1.1 2005/10/05 14:09:21 janb Exp $
03: //Copyright 2004-2005 Mort Bay Consulting Pty. Ltd.
04: //------------------------------------------------------------------------
05: //Licensed under the Apache License, Version 2.0 (the "License");
06: //you may not use this file except in compliance with the License.
07: //You may obtain a copy of the License at
08: //http://www.apache.org/licenses/LICENSE-2.0
09: //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.jetty;
17:
18: import java.io.IOException;
19:
20: import javax.servlet.ServletException;
21: import javax.servlet.http.HttpServletRequest;
22: import javax.servlet.http.HttpServletResponse;
23:
24: import org.mortbay.component.LifeCycle;
25:
26: public interface Handler extends LifeCycle {
27: /** Dispatch types */
28: public static final int DEFAULT = 0;
29: public static final int REQUEST = 1;
30: public static final int FORWARD = 2;
31: public static final int INCLUDE = 4;
32: public static final int ERROR = 8;
33: public static final int ALL = 15;
34:
35: /* ------------------------------------------------------------ */
36: /** Handle a request.
37: * @param target The target of the request - either a URI or a name.
38: * @param request The request either as the {@link Request}
39: * object or a wrapper of that request. The {@link HttpConnection#getCurrentConnection()}
40: * method can be used access the Request object if required.
41: * @param response The response as the {@link Response}
42: * object or a wrapper of that request. The {@link HttpConnection#getCurrentConnection()}
43: * method can be used access the Response object if required.
44: * @param dispatch The dispatch mode: {@link #REQUEST}, {@link #FORWARD}, {@link #INCLUDE}, {@link #ERROR}
45: * @throws IOException
46: * @throws ServletException
47: */
48: public void handle(String target, HttpServletRequest request,
49: HttpServletResponse response, int dispatch)
50: throws IOException, ServletException;
51:
52: public void setServer(Server server);
53:
54: public Server getServer();
55:
56: public void destroy();
57:
58: }
|