|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.faunos.util.net.http.RequestStage
public class RequestStage
The first stage in the implementation of HTTP. This class reads the HTTP request headers, and dispatches the processing to the next stage.
ResponseFactory
Constructor Summary | |
---|---|
RequestStage(StageletStack stack,
ResponseFactory responseFactory)
|
|
RequestStage(StageletStack stack,
ResponseFactory responseFactory,
long maxHeaderSize)
|
Method Summary | |
---|---|
void |
discard()
Discards the instance. |
Map<String,String> |
getProperties()
Returns a name/value map encapsulating the HTTP request headers received. |
String |
getUri()
Returns the URI referenced in the first line of the HTTP request. |
Verb |
getVerb()
Returns the HTTP verb. |
String |
getVersion()
Returns the HTTP version string in the first line of the HTTP request. |
IoState |
init(HandletContext context)
Initializes the handlet. |
boolean |
isPersistentConnection()
Determines whether this will be a persistent connection. |
IoState |
read(ScatteringByteChannel in)
Reads from the specified channel and returns the possibly new state of the instance. |
void |
setCloseConnection()
|
IoState |
state()
Returns the state of the handlet. |
IoState |
unwind(IoState preState)
Callback method invoked when the previous stage[let] returned DONE. |
IoState |
write(GatheringByteChannel out)
Writes to the specified channel and returns the possibly new state of the instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestStage(StageletStack stack, ResponseFactory responseFactory)
public RequestStage(StageletStack stack, ResponseFactory responseFactory, long maxHeaderSize)
Method Detail |
---|
public Verb getVerb()
RequestHeader
getVerb
in interface RequestHeader
public String getUri()
RequestHeader
getUri
in interface RequestHeader
public String getVersion()
RequestHeader
getVersion
in interface RequestHeader
public Map<String,String> getProperties()
RequestHeader
${name}: ${value} CRLF
getProperties
in interface RequestHeader
public boolean isPersistentConnection()
RequestHeader
isPersistentConnection
in interface RequestHeader
public void setCloseConnection()
public void discard()
Handlet
discard
in interface Handlet
public IoState init(HandletContext context)
Handlet
init
in interface Handlet
context
- the context supplied by the instance's container (e.g.
serverpublic IoState read(ScatteringByteChannel in) throws IOException
Handlet
Handlet.state()
may
return a value other than PROCESSING
, if the asynchronous
task completes before the call to state()
.
The implementation must read from the channel in non-blocking manner.
The behavior of this method is undefined if the state of the instance is not IoState.READING.
read
in interface Handlet
IOException
public IoState state()
Handlet
state
in interface Handlet
public IoState unwind(IoState preState)
Stagelet
Handlet.discard()
method on the super
interface.
unwind
in interface Stagelet
preState
- the state of the previous stage prior to its flipping to
DONE
Stagelet
on the execution
stack, then that stage's unwind()
method will also
be invoked with the same preState
argument.public IoState write(GatheringByteChannel out) throws IOException, UnsupportedOperationException
Handlet
Handlet.state()
may
return a value other than PROCESSING
, if the asynchronous
task completes before the call to state()
.
The implementation must write to the channel in non-blocking manner.
The behavior of this method is undefined if the state of the instance is not IoState.WRITING.
write
in interface Handlet
IOException
UnsupportedOperationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |