net.noderunner.http
Interface HttpServer

All Known Implementing Classes:
BasicHttpServer

public interface HttpServer

Specifies methods for an HTTP server, which is handling a single request from an HTTP client. Methods must be called in specific order for a successful HTTP exchange to take place. The order of calls that must be made is:


Method Summary
 void close()
          Closes and releases any open connections or resources used by this server.
 OutputStream getOutputStream()
          Returns a stream for writing data to, if data is to be sent to the client.
 ServerRequest readRequest()
          Reads the HTTP Request information.
 void writeResponse(ServerResponse response)
          Sends response data to the HTTP client.
 

Method Detail

readRequest

ServerRequest readRequest()
                          throws IOException
Reads the HTTP Request information.

Throws:
IllegalHttpStateException - if the request was already read
IOException

writeResponse

void writeResponse(ServerResponse response)
                   throws IOException
Sends response data to the HTTP client.

Throws:
IllegalHttpStateException - if the request was not yet read or the response was already sent
HttpException - if the server returned an invalid HTTP response
IOException

getOutputStream

OutputStream getOutputStream()
Returns a stream for writing data to, if data is to be sent to the client.

Throws:
IllegalHttpStateException - if the request was not yet read, or the response was already sent, or data was sent by a DataPoster, or this method was already called

close

void close()
           throws IOException
Closes and releases any open connections or resources used by this server.

Throws:
IOException


Copyright © 2011. All Rights Reserved.