org.jwall.web.http.nio
Class HttpResponseChannel

java.lang.Object
  extended by org.jwall.web.http.nio.HttpMessageChannel<HttpResponse>
      extended by org.jwall.web.http.nio.HttpResponseChannel

public class HttpResponseChannel
extends HttpMessageChannel<HttpResponse>

This class reads from an incoming stream and buffers it, parsing the stream to read the responses. Optional it can be requested to merge chunked http-data. (not implemented yet)

Author:
chris@jwall.org

Field Summary
static int READING_CHUNK_BODY
           
static int READING_CHUNK_HEADER
           
static int READING_CHUNK_TRAILER
           
static int READING_CRLF
           
static int STATE_CLOSE_CONNECTION
           
static int STATE_READING_CHUNKS
           
 
Fields inherited from class org.jwall.web.http.nio.HttpMessageChannel
STATE_READING_BODY, STATE_READING_HEADER
 
Constructor Summary
HttpResponseChannel(ReadableByteChannel in)
          Create a stream of http-response-packets by reading from the given input-stream.
 
Method Summary
 String chunkState()
           
 int getId()
           
 int getNumberOfResponses()
           
 boolean isConnectionClosed()
          Returns true if the server has send an "Connection: close" within the last response.
 HttpChunk readChunk()
           
 HttpResponse readMessage()
           
 String status()
           
 String toString()
           
 
Methods inherited from class org.jwall.web.http.nio.HttpMessageChannel
close, getState, getTimeout, readBody, readHeader, setTimeout, timedOut, touch
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_READING_CHUNKS

public static final int STATE_READING_CHUNKS
See Also:
Constant Field Values

STATE_CLOSE_CONNECTION

public static final int STATE_CLOSE_CONNECTION
See Also:
Constant Field Values

READING_CHUNK_HEADER

public static final int READING_CHUNK_HEADER
See Also:
Constant Field Values

READING_CHUNK_BODY

public static final int READING_CHUNK_BODY
See Also:
Constant Field Values

READING_CHUNK_TRAILER

public static final int READING_CHUNK_TRAILER
See Also:
Constant Field Values

READING_CRLF

public static final int READING_CRLF
See Also:
Constant Field Values
Constructor Detail

HttpResponseChannel

public HttpResponseChannel(ReadableByteChannel in)
Create a stream of http-response-packets by reading from the given input-stream.

Parameters:
in -
Method Detail

readMessage

public HttpResponse readMessage()
                         throws IOException,
                                TimeOutException,
                                ProtocolException
Specified by:
readMessage in class HttpMessageChannel<HttpResponse>
Throws:
IOException
TimeOutException
ProtocolException

readChunk

public HttpChunk readChunk()
                    throws IOException,
                           ProtocolException
Throws:
IOException
ProtocolException

toString

public String toString()
Overrides:
toString in class Object

status

public String status()

chunkState

public String chunkState()

isConnectionClosed

public boolean isConnectionClosed()
Returns true if the server has send an "Connection: close" within the last response.

Returns:

getNumberOfResponses

public int getNumberOfResponses()

getId

public int getId()


Copyright © 2012 jwall.org. All Rights Reserved.