fi.iki.elonen.nanohttpd
Class NanoHTTPD.Response

java.lang.Object
  extended by fi.iki.elonen.nanohttpd.NanoHTTPD.Response
Enclosing class:
NanoHTTPD

public class NanoHTTPD.Response
extends java.lang.Object

HTTP response. Return one of these from serve().


Field Summary
 java.io.InputStream data
          Data of the response, may be null.
 java.util.Properties header
          Headers for the HTTP response.
 java.lang.String mimeType
          MIME type of content, e.g.
 java.lang.String status
          HTTP status code after processing, e.g.
 
Constructor Summary
NanoHTTPD.Response()
          Default constructor: response = HTTP_OK, data = mime = 'null'
NanoHTTPD.Response(java.lang.String status, java.lang.String mimeType, java.io.InputStream data)
          Basic constructor.
NanoHTTPD.Response(java.lang.String status, java.lang.String mimeType, java.lang.String txt)
          Convenience method that makes an InputStream out of given text.
 
Method Summary
 void addHeader(java.lang.String name, java.lang.String value)
          Adds given line to the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

public java.lang.String status
HTTP status code after processing, e.g. "200 OK", HTTP_OK


mimeType

public java.lang.String mimeType
MIME type of content, e.g. "text/html"


data

public java.io.InputStream data
Data of the response, may be null.


header

public java.util.Properties header
Headers for the HTTP response. Use addHeader() to add lines.

Constructor Detail

NanoHTTPD.Response

public NanoHTTPD.Response()
Default constructor: response = HTTP_OK, data = mime = 'null'


NanoHTTPD.Response

public NanoHTTPD.Response(java.lang.String status,
                          java.lang.String mimeType,
                          java.io.InputStream data)
Basic constructor.


NanoHTTPD.Response

public NanoHTTPD.Response(java.lang.String status,
                          java.lang.String mimeType,
                          java.lang.String txt)
Convenience method that makes an InputStream out of given text.

Method Detail

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Adds given line to the header.