com.bigdata.util.httpd
Class AbstractHTTPD

java.lang.Object
  extended by com.bigdata.util.httpd.NanoHTTPD
      extended by com.bigdata.util.httpd.AbstractHTTPD
All Implemented Interfaces:
IServiceShutdown
Direct Known Subclasses:
CounterSetHTTPD

public abstract class AbstractHTTPD
extends NanoHTTPD

Overrides some methods on NanoHTTPD to (a) prevent serving files from the local file system; and (b) to expose methods for handling GET, PUT, POST, and DELETE requests - these methods all return a NanoHTTPD.HTTP_METHOD_NOT_ALLOWED Response by default.

Version:
$Id: AbstractHTTPD.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bigdata.util.httpd.NanoHTTPD
NanoHTTPD.Response
 
Nested classes/interfaces inherited from interface com.bigdata.service.IServiceShutdown
IServiceShutdown.Options
 
Field Summary
 
Fields inherited from class com.bigdata.util.httpd.NanoHTTPD
HTTP_BADREQUEST, HTTP_FORBIDDEN, HTTP_INTERNALERROR, HTTP_METHOD_NOT_ALLOWED, HTTP_NOTFOUND, HTTP_NOTIMPLEMENTED, HTTP_OK, HTTP_REDIRECT, log, MIME_APPLICATION_XML, MIME_DEFAULT_BINARY, MIME_TEXT_HTML, MIME_TEXT_JAVASCRIPT, MIME_TEXT_PLAIN
 
Constructor Summary
AbstractHTTPD(int port)
           
 
Method Summary
 NanoHTTPD.Response doDelete(String uri, String method, Properties header, LinkedHashMap<String,Vector<String>> parms)
           
 NanoHTTPD.Response doGet(String uri, String method, Properties header, LinkedHashMap<String,Vector<String>> parms)
           
 NanoHTTPD.Response doPost(String uri, String method, Properties header, LinkedHashMap<String,Vector<String>> parms)
           
 NanoHTTPD.Response doPut(String uri, String method, Properties header, LinkedHashMap<String,Vector<String>> parms)
           
 NanoHTTPD.Response serve(String uri, String method, Properties header, LinkedHashMap<String,Vector<String>> parms)
          Override this to customize the server.
 
Methods inherited from class com.bigdata.util.httpd.NanoHTTPD
decodeParms, getPort, isOpen, main, serveFile, shutdown, shutdownNow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHTTPD

public AbstractHTTPD(int port)
              throws IOException
Throws:
IOException
Method Detail

serve

public NanoHTTPD.Response serve(String uri,
                                String method,
                                Properties header,
                                LinkedHashMap<String,Vector<String>> parms)
Description copied from class: NanoHTTPD
Override this to customize the server.

(By default, this delegates to serveFile() and allows directory listing.)

Overrides:
serve in class NanoHTTPD
Parameters:
uri - Percent-decoded URI without parameters, for example "/index.cgi"
method - "GET", "POST" etc.
header - Header entries, percent decoded
parms - Parsed, percent decoded parameters from URI and, in case of POST, data. The keys are the parameter names. Each value is a Collection of Strings containing the bindings for the named parameter. The order of the URL parameters is preserved.
Returns:
HTTP response, see class Response for details

doGet

public NanoHTTPD.Response doGet(String uri,
                                String method,
                                Properties header,
                                LinkedHashMap<String,Vector<String>> parms)
                         throws Exception
Parameters:
uri - Percent-decoded URI without parameters, for example "/index.cgi"
method - "GET", "POST" etc.
parms - Parsed, percent decoded parameters from URI and, in case of POST, data. The keys are the parameter names. Each value is a Collection of Strings containing the bindings for the named parameter. The order of the URL parameters is preserved.
header - Header entries, percent decoded
Returns:
Throws:
Exception

doPost

public NanoHTTPD.Response doPost(String uri,
                                 String method,
                                 Properties header,
                                 LinkedHashMap<String,Vector<String>> parms)
                          throws Exception
Throws:
Exception

doPut

public NanoHTTPD.Response doPut(String uri,
                                String method,
                                Properties header,
                                LinkedHashMap<String,Vector<String>> parms)
                         throws Exception
Throws:
Exception

doDelete

public NanoHTTPD.Response doDelete(String uri,
                                   String method,
                                   Properties header,
                                   LinkedHashMap<String,Vector<String>> parms)
                            throws Exception
Throws:
Exception


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.