/lib/apache-log4j/contribs/VolkerMentzner/HTTPRequestHandler.java

https://bitbucket.org/arkban/somersault · Java · 75 lines · 12 code · 9 blank · 54 comment · 0 complexity · 2bf05aa23e8f0562350f52dd5e60e3a8 MD5 · raw file

  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. */
  17. package com.psibt.framework.net;
  18. import java.io.*;
  19. import java.net.*;
  20. /**
  21. * This interface defines all methods that have to be implemented for a HTTPRequestHandler for the
  22. * PluggableHTTPServer.
  23. *
  24. * @author <a HREF="mailto:V.Mentzner@psi-bt.de">Volker Mentzner</a>
  25. */
  26. public interface HTTPRequestHandler {
  27. /**
  28. * Gets the title for html page
  29. */
  30. public String getTitle();
  31. /**
  32. * Sets the title for html page
  33. */
  34. public void setTitle(String title);
  35. /**
  36. * Gets the description for html page
  37. */
  38. public String getDescription();
  39. /**
  40. * Sets the description for html page
  41. */
  42. public void setDescription(String description);
  43. /**
  44. * Gets the virtual path in the HTTP server that ist handled in this HTTPRequestHandler.
  45. * So the root path handler will return "/" (without brackets) because it handles the path
  46. * "http://servername/" or a handler for "http://servername/somepath/" will return "/somepath/"
  47. * It is important to include the trailing "/" because all HTTPRequestHandler have to serve a path!
  48. */
  49. public String getHandledPath();
  50. /**
  51. * Sets the virtual path in the HTTP server that ist handled in this HTTPRequestHandler.
  52. * So set the path to "/" for the root path handler because it handles the path
  53. * "http://servername/" or set it to "/somepath/" for a handler for "http://servername/somepath/".
  54. * It is important to include the trailing "/" because all HTTPRequestHandler have to serve a path!
  55. */
  56. public void setHandledPath(String path);
  57. /**
  58. * Handles the given request and writes the reply to the given out-stream. Every handler has to check
  59. * the request for the right path info.
  60. *
  61. * @param request - client browser request
  62. * @param out - Out stream for sending data to client browser
  63. * @return if the request was handled by this handler : true, else : false
  64. */
  65. public boolean handleRequest(String request, Writer out);
  66. }