public class BasicHttpServer extends Object implements HttpServer
BasicHttpClient
Constructor and Description |
---|
BasicHttpServer(OutputStream os,
InputStream is)
Constructs a BasicHttpServer that communicates over
an input and output stream.
|
BasicHttpServer(Socket socket)
Constructs a BasicHttpServer that communicates over
a socket.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying input and output streams.
|
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. |
String |
toString()
Returns debug information.
|
void |
writeResponse(ServerResponse response)
Sends response data to the HTTP client.
|
public BasicHttpServer(Socket socket) throws IOException
IOException
public BasicHttpServer(OutputStream os, InputStream is)
public ServerRequest readRequest() throws IOException
HttpServer
Request
information.readRequest
in interface HttpServer
IOException
public void writeResponse(ServerResponse response) throws IOException
HttpServer
writeResponse
in interface HttpServer
HttpException
- if the server returned an invalid HTTP
responseIOException
public OutputStream getOutputStream()
HttpServer
getOutputStream
in interface HttpServer
public void close() throws IOException
close
in interface HttpServer
IOException
Copyright © 2012. All Rights Reserved.