KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > psibt > framework > net > HTTPRequestHandler


1 /*
2  * Copyright 1999-2005 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 package com.psibt.framework.net;
17
18 import java.io.*;
19 import java.net.*;
20
21 /**
22  * This interface defines all methods that have to be implemented for a HTTPRequestHandler for the
23  * PluggableHTTPServer.
24  *
25  * @author <a HREF="mailto:V.Mentzner@psi-bt.de">Volker Mentzner</a>
26  */

27 public interface HTTPRequestHandler {
28
29  /**
30    * Gets the title for html page
31    */

32   public String JavaDoc getTitle();
33
34  /**
35    * Sets the title for html page
36    */

37   public void setTitle(String JavaDoc title);
38
39  /**
40    * Gets the description for html page
41    */

42   public String JavaDoc getDescription();
43
44  /**
45    * Sets the description for html page
46    */

47   public void setDescription(String JavaDoc description);
48
49  /**
50    * Gets the virtual path in the HTTP server that ist handled in this HTTPRequestHandler.
51    * So the root path handler will return "/" (without brackets) because it handles the path
52    * "http://servername/" or a handler for "http://servername/somepath/" will return "/somepath/"
53    * It is important to include the trailing "/" because all HTTPRequestHandler have to serve a path!
54    */

55   public String JavaDoc getHandledPath();
56
57  /**
58    * Sets the virtual path in the HTTP server that ist handled in this HTTPRequestHandler.
59    * So set the path to "/" for the root path handler because it handles the path
60    * "http://servername/" or set it to "/somepath/" for a handler for "http://servername/somepath/".
61    * It is important to include the trailing "/" because all HTTPRequestHandler have to serve a path!
62    */

63   public void setHandledPath(String JavaDoc path);
64
65  /**
66    * Handles the given request and writes the reply to the given out-stream. Every handler has to check
67    * the request for the right path info.
68    *
69    * @param request - client browser request
70    * @param out - Out stream for sending data to client browser
71    * @return if the request was handled by this handler : true, else : false
72    */

73   public boolean handleRequest(String JavaDoc request, Writer out);
74 }
Popular Tags