Package io.fusionauth.http.server
Interface HTTPProcessor
- All Known Implementing Classes:
HTTP11Processor,HTTPS11Processor
public interface HTTPProcessor
Generic interface that is used by all the processors to allow worker threads and other hooks into the processing of the requests and
responses.
- Author:
- Brian Pontarelli
-
Method Summary
Modifier and TypeMethodDescriptionclose(boolean endOfStream) Closes the processing.voidSignals to the processor that the request handling failed in some way.intAllows the HTTPProcessor to determine what the initial key operations are for the SelectionKey.longlastUsed()read(ByteBuffer buffer) Allows the HTTPProcessor to handle bytes that were read.longstate()longwrote(long num) Called by the selector to tell the HTTPProcessor that bytes were written back to the client.
-
Method Details
-
close
Closes the processing. In some cases, the process of closing a connection might require additional work, like shutting down TLS. Therefore, this method can interrupt a normal shutdown.- Parameters:
endOfStream- True if the stream is being closed due to an unexpected end-of-stream.- Returns:
- The new state of the processor.
- Throws:
IOException- If the close operation failed for any reason.
-
failure
Signals to the processor that the request handling failed in some way.- Parameters:
t- The exception that caused the failure, it there was one.
-
initialKeyOps
int initialKeyOps()Allows the HTTPProcessor to determine what the initial key operations are for the SelectionKey. For TLS, this is usually READ and WRITE in order to handle the handshake. For non-TLS, this is usually just READ.- Returns:
- The initial interested ops.
- See Also:
-
lastUsed
long lastUsed()- Returns:
- The instant that this processor was last used.
-
read
Allows the HTTPProcessor to handle bytes that were read.- Parameters:
buffer- The bytes read from the client.- Returns:
- The new state of the HTTPProcessor.
- Throws:
IOException- If any I/O operations failed.
-
readBuffer
- Returns:
- The current read buffer or null if the state has changed or there we aren't expecting to read.
- Throws:
IOException- If any I/O operations failed.
-
readThroughput
long readThroughput()- Returns:
- The bytes per second throughput read by this processor.
-
state
ProcessorState state()- Returns:
- The current state of the HTTPProcessor.
-
writeBuffers
- Returns:
- The current write buffer(s) and never null.
- Throws:
IOException- If any I/O operations failed.
-
writeThroughput
long writeThroughput()- Returns:
- The bytes per second throughput wrote by this processor.
-
wrote
Called by the selector to tell the HTTPProcessor that bytes were written back to the client.- Parameters:
num- The number of bytes written.- Returns:
- The new state of the HTTPProcessor.
- Throws:
IOException- If any I/O operations failed.
-