Package io.undertow.httpcore
Class HttpExchangeBase
java.lang.Object
io.undertow.httpcore.HttpExchangeBase
- All Implemented Interfaces:
HttpExchange,OutputChannel,Closeable,AutoCloseable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWriteFunction(WriteFunction listener) voidlongbooleanReturns true if the completion handler for this exchange has been invoked, and the request is considered finished.booleanReturns true if all data has been read from the request, or if there was not data.protected booleanbooleanprotected booleanprotected booleanvoidsetBlockingHttpExchange(BlockingHttpExchange exchange) voidsetCompletedListener(CompletedListener listener) voidsetPreCommitListener(PreCommitListener listener) protected voidForce the codec to treat the request as fully read.protected voidForce the codec to treat the response as fully written.final <T> voidwriteAsync(io.netty.buffer.ByteBuf data, boolean last, IoCallback<T> callback, T context) final voidwriteAsync(String data) Writes the given UTF-8 data and ends the exchangefinal voidwriteAsync(String data, Charset charset) Writes the given data in the provided charset and ends the exchangefinal <T> voidwriteAsync(String data, Charset charset, boolean last, IoCallback<T> callback, T context) Writes the given data in the provided charset and invokes the provided callback on completionprotected abstract <T> voidwriteAsync0(io.netty.buffer.ByteBuf data, boolean last, IoCallback<T> callback, T context) final voidwriteBlocking(io.netty.buffer.ByteBuf data, boolean last) protected abstract voidwriteBlocking0(io.netty.buffer.ByteBuf data, boolean last) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.undertow.httpcore.HttpExchange
addRequestHeader, addResponseHeader, clearRequestHeaders, clearResponseHeaders, close, containsRequestHeader, containsResponseHeader, discardRequest, getBufferAllocator, getDestinationAddress, getInputChannel, getIoThread, getMaxEntitySize, getProtocol, getReadTimeout, getRequestContentLength, getRequestHeader, getRequestHeaderNames, getRequestHeaders, getRequestMethod, getRequestScheme, getRequestURI, getResponseContentLength, getResponseHeader, getResponseHeaderNames, getResponseHeaders, getSourceAddress, getSslSessionInfo, getStatusCode, getUndertowOptions, getWorker, isHttp2, isInIoThread, isIoOperationQueued, isPushSupported, isRequestTrailerFieldsSupported, isUpgrade, isUpgradeSupported, pushResource, removeRequestHeader, removeResponseHeader, sendContinue, setMaxEntitySize, setReadTimeout, setRequestHeader, setResponseHeader, setStatusCode, setUndertowOptions, setUpgradeListener
-
Field Details
-
preCommitListener
-
-
Constructor Details
-
HttpExchangeBase
public HttpExchangeBase()
-
-
Method Details
-
setCompletedListener
- Specified by:
setCompletedListenerin interfaceHttpExchange
-
setPreCommitListener
- Specified by:
setPreCommitListenerin interfaceHttpExchange
-
terminateRequest
protected void terminateRequest()Force the codec to treat the request as fully read. Should only be invoked by handlers which downgrade the socket or implement a transfer coding. -
terminateResponse
protected void terminateResponse()Force the codec to treat the response as fully written. Should only be invoked by handlers which downgrade the socket or implement a transfer coding. -
setBlockingHttpExchange
- Specified by:
setBlockingHttpExchangein interfaceHttpExchange
-
getOutputStream
- Specified by:
getOutputStreamin interfaceHttpExchange
-
getInputStream
- Specified by:
getInputStreamin interfaceHttpExchange
-
isComplete
public boolean isComplete()Returns true if the completion handler for this exchange has been invoked, and the request is considered finished.- Specified by:
isCompletein interfaceHttpExchange
-
isRequestComplete
public boolean isRequestComplete()Returns true if all data has been read from the request, or if there was not data.- Specified by:
isRequestCompletein interfaceHttpExchange- Returns:
- true if the request is complete
-
isResponseComplete
public boolean isResponseComplete()- Specified by:
isResponseCompletein interfaceHttpExchange- Returns:
- true if the responses is complete
-
endExchange
public void endExchange()- Specified by:
endExchangein interfaceHttpExchange
-
writeAsync
Description copied from interface:OutputChannelWrites the given UTF-8 data and ends the exchange- Specified by:
writeAsyncin interfaceOutputChannel- Parameters:
data- The data to write
-
writeAsync
Description copied from interface:OutputChannelWrites the given data in the provided charset and ends the exchange- Specified by:
writeAsyncin interfaceOutputChannel- Parameters:
data- The data to write
-
writeAsync
public final <T> void writeAsync(String data, Charset charset, boolean last, IoCallback<T> callback, T context) Description copied from interface:OutputChannelWrites the given data in the provided charset and invokes the provided callback on completion- Specified by:
writeAsyncin interfaceOutputChannel- Parameters:
data- The data to write
-
addWriteFunction
- Specified by:
addWriteFunctionin interfaceHttpExchange
-
getOutputChannel
- Specified by:
getOutputChannelin interfaceHttpExchange
-
isResponseStarted
protected boolean isResponseStarted() -
writeAsync
public final <T> void writeAsync(io.netty.buffer.ByteBuf data, boolean last, IoCallback<T> callback, T context) - Specified by:
writeAsyncin interfaceOutputChannel
-
writeAsync0
protected abstract <T> void writeAsync0(io.netty.buffer.ByteBuf data, boolean last, IoCallback<T> callback, T context) -
writeBlocking
- Specified by:
writeBlockingin interfaceOutputChannel- Throws:
IOException
-
writeBlocking0
protected abstract void writeBlocking0(io.netty.buffer.ByteBuf data, boolean last) throws IOException - Throws:
IOException
-
getResponseBytesSent
public long getResponseBytesSent()- Specified by:
getResponseBytesSentin interfaceHttpExchange- Returns:
- The number of bytes sent in the entity body
-
isResponseEntityBodyAllowed
protected boolean isResponseEntityBodyAllowed() -
isRequestEntityBodyAllowed
protected boolean isRequestEntityBodyAllowed()
-