java.lang.Object
juju.reattore.server.http.HttpClientHandler
- All Implemented Interfaces:
- juju.reattore.core.reactor.ClientSocketHandler, juju.reattore.core.reactor.Handler
- public class HttpClientHandler
- extends java.lang.Object
- implements juju.reattore.core.reactor.ClientSocketHandler
Handler that knows about the HTTP protocol.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static org.apache.commons.logging.Log log
DEFAULT_IN_CAPACITY
private static final int DEFAULT_IN_CAPACITY
- See Also:
- Constant Field Values
DEFAULT_OUT_CAPACITY
private static final int DEFAULT_OUT_CAPACITY
- See Also:
- Constant Field Values
STATE_WRITE_START
private static final int STATE_WRITE_START
- See Also:
- Constant Field Values
STATE_WRITE_NEXT
private static final int STATE_WRITE_NEXT
- See Also:
- Constant Field Values
writeState
private int writeState
mediator
private HttpMediator mediator
ch
private java.nio.channels.SocketChannel ch
in
private java.nio.ByteBuffer in
headers
private java.nio.ByteBuffer headers
body
private juju.reattore.io.ByteSource body
bodyPart
private java.nio.ByteBuffer bodyPart
shouldClose
private boolean shouldClose
pending
private java.util.List pending
- List of HttpRequests not yet processed
parser
private juju.reattore.protocol.http.HttpParser parser
readStat
private static juju.reattore.util.DurationStat readStat
parseStat
private static juju.reattore.util.DurationStat parseStat
processStat
private static juju.reattore.util.DurationStat processStat
writeStat
private static juju.reattore.util.DurationStat writeStat
writeRateStat
private static juju.reattore.util.RateStat writeRateStat
serveRateStat
private static juju.reattore.util.RateStat serveRateStat
errorRateStat
private static juju.reattore.util.RateStat errorRateStat
concurrentStat
private static juju.reattore.util.GaugeStat concurrentStat
reqsLeft
private int reqsLeft
HttpClientHandler
public HttpClientHandler(java.nio.channels.SocketChannel ch,
HttpMediator mediator)
- Create a new HTTP handler.
getInterestOps
public int getInterestOps()
- Description copied from interface:
juju.reattore.core.reactor.Handler
- Returns the set of operations this handler is currently
interested in. See SelectorKey for more informration.
- Specified by:
getInterestOps in interface juju.reattore.core.reactor.Handler
done
private void done()
handleConnected
public boolean handleConnected()
throws java.io.IOException
- Description copied from interface:
juju.reattore.core.reactor.ClientSocketHandler
- Called when the socket is initially connected. This does not
imply that the channel is readable or writable.
- Specified by:
handleConnected in interface juju.reattore.core.reactor.ClientSocketHandler
handleReadable
public boolean handleReadable()
throws java.io.IOException
- Description copied from interface:
juju.reattore.core.reactor.ClientSocketHandler
- Called when the attached socket has data available.
- Specified by:
handleReadable in interface juju.reattore.core.reactor.ClientSocketHandler
getBytes
private byte[] getBytes(java.lang.StringBuffer in)
processNext
private boolean processNext()
throws java.io.IOException
write
private boolean write()
throws java.io.IOException
writeBody
private boolean writeBody()
throws java.io.IOException
handleWritable
public boolean handleWritable()
throws java.io.IOException
- Description copied from interface:
juju.reattore.core.reactor.ClientSocketHandler
- Called when the attached socket is ready to be written to.
- Specified by:
handleWritable in interface juju.reattore.core.reactor.ClientSocketHandler
handleError
public void handleError()
- Description copied from interface:
juju.reattore.core.reactor.ClientSocketHandler
- Called when any error occurs on the attached socket. Does not
distinguish between connection, transient, or fatal errors.
The socket may not be usable.
- Specified by:
handleError in interface juju.reattore.core.reactor.ClientSocketHandler