/lib/apache-log4j/contribs/VolkerMentzner/HTTPRequestHandler.java
Java | 75 lines | 12 code | 9 blank | 54 comment | 0 complexity | 2bf05aa23e8f0562350f52dd5e60e3a8 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, Apache-2.0
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package com.psibt.framework.net;
18
19import java.io.*;
20import java.net.*;
21
22/**
23 * This interface defines all methods that have to be implemented for a HTTPRequestHandler for the
24 * PluggableHTTPServer.
25 *
26 * @author <a HREF="mailto:V.Mentzner@psi-bt.de">Volker Mentzner</a>
27 */
28public interface HTTPRequestHandler {
29
30 /**
31 * Gets the title for html page
32 */
33 public String getTitle();
34
35 /**
36 * Sets the title for html page
37 */
38 public void setTitle(String title);
39
40 /**
41 * Gets the description for html page
42 */
43 public String getDescription();
44
45 /**
46 * Sets the description for html page
47 */
48 public void setDescription(String description);
49
50 /**
51 * Gets the virtual path in the HTTP server that ist handled in this HTTPRequestHandler.
52 * So the root path handler will return "/" (without brackets) because it handles the path
53 * "http://servername/" or a handler for "http://servername/somepath/" will return "/somepath/"
54 * It is important to include the trailing "/" because all HTTPRequestHandler have to serve a path!
55 */
56 public String getHandledPath();
57
58 /**
59 * Sets the virtual path in the HTTP server that ist handled in this HTTPRequestHandler.
60 * So set the path to "/" for the root path handler because it handles the path
61 * "http://servername/" or set it to "/somepath/" for a handler for "http://servername/somepath/".
62 * It is important to include the trailing "/" because all HTTPRequestHandler have to serve a path!
63 */
64 public void setHandledPath(String path);
65
66 /**
67 * Handles the given request and writes the reply to the given out-stream. Every handler has to check
68 * the request for the right path info.
69 *
70 * @param request - client browser request
71 * @param out - Out stream for sending data to client browser
72 * @return if the request was handled by this handler : true, else : false
73 */
74 public boolean handleRequest(String request, Writer out);
75}