|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infoservice.InfoServiceConnection
public final class InfoServiceConnection
This is a simple implementation of an HTTP server. This implementation doesn't support the most HTTP/1.1 stuff (like persistent connections or special encodings). But parsing an HTTP/1.1 request is working.
Field Summary | |
---|---|
private int |
m_byteLimit
This stores the currently number of bytes which can be read from the InputStream until the data limit is exhausted. |
private int |
m_connectionId
Stores the ID of the connection which is used in the log-output for identifying the current connection. |
private java.io.InputStream |
m_inputStream
|
private JWSInternalCommands |
m_serverImplementation
Stores the implementation which is used for processing the received HTTP request and creating the HTTP response which is sent back to the client. |
private java.net.Socket |
m_socket
Stores the socket which is connected to the client we got the request from. |
private java.io.ByteArrayOutputStream |
m_tmpByteArrayOut
|
Constructor Summary | |
---|---|
InfoServiceConnection(java.net.Socket a_socket,
int a_connectionId,
JWSInternalCommands a_serverImplementation)
Creates a new instance of InfoServiceConnection for handling the received data as an HTTP request. |
Method Summary | |
---|---|
private void |
closeSockets()
|
private void |
initReader(int limit)
|
private int |
read()
Reads one byte from the underlying InputStream. |
private java.util.Vector |
readHeader()
Reads the whole header of an HTTP request (including the last CRLF signalizing the end of the header, so the next byte read from the stream would be the first of the HTTP content). |
private java.lang.String |
readRequestLine()
Reads the first line of an HTTP request (including the CRLF at the end of the line, so the next byte read from the underlying stream, is the first byte of the request header). |
void |
run()
This is the Thread implementation for reading, parsing, processing the request and sending the response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.net.Socket m_socket
private java.io.InputStream m_inputStream
private int m_connectionId
private JWSInternalCommands m_serverImplementation
private int m_byteLimit
private java.io.ByteArrayOutputStream m_tmpByteArrayOut
Constructor Detail |
---|
public InfoServiceConnection(java.net.Socket a_socket, int a_connectionId, JWSInternalCommands a_serverImplementation)
a_socket
- The socket which is connected to the client. We read the data from this
socket, parse it as an HTTP request, process the request and send back the
HTTP response to this socket.a_connectionId
- The connection ID which is used for identifying the log outputs of this
new instance of InfoServiceConnection.a_serverImplementation
- The implementation which is used for processing the HTTP
request and creating the HTTP response which is sent back to
the client.Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
private void closeSockets()
private java.lang.String readRequestLine() throws java.lang.Exception
a_inputData
- The InfoServiceConnectionReader for reading the line (with a limit of
maximally read bytes).
java.lang.Exception
private void initReader(int limit)
private int read() throws java.lang.Exception
java.lang.Exception
private java.util.Vector readHeader() throws java.lang.Exception
a_inputData
- The InfoServiceConnectionReader where the HTTP header shall be read from
(with a limit of maximally read bytes). The initially request line of the
HTTP request should already be read from the underlying stream.
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |