Interface HttpExchange

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
HttpExchangeBase

public interface HttpExchange extends Closeable
  • Method Details

    • getBufferAllocator

      BufferAllocator getBufferAllocator()
    • setStatusCode

      HttpExchange setStatusCode(int code)
    • getStatusCode

      int getStatusCode()
    • getRequestHeader

      String getRequestHeader(String name)
      Gets the first request header with the given name
      Parameters:
      name - The header name
      Returns:
      The header value, or null if it is not present
    • getRequestHeaders

      List<String> getRequestHeaders(String name)
      Gets request headers with the given name
      Parameters:
      name - The header name
      Returns:
      The header value, or an empty list if none are present
    • containsRequestHeader

      boolean containsRequestHeader(String name)
    • removeRequestHeader

      void removeRequestHeader(String name)
    • setRequestHeader

      void setRequestHeader(String name, String value)
    • getRequestHeaderNames

      Collection<String> getRequestHeaderNames()
    • addRequestHeader

      void addRequestHeader(String name, String value)
    • clearRequestHeaders

      void clearRequestHeaders()
    • getResponseHeaders

      List<String> getResponseHeaders(String name)
      Gets response headers with the given name
      Parameters:
      name - The header name
      Returns:
      The header value, or an empty list if none are present
    • containsResponseHeader

      boolean containsResponseHeader(String name)
    • removeResponseHeader

      void removeResponseHeader(String name)
    • setResponseHeader

      void setResponseHeader(String name, String value)
    • getResponseHeaderNames

      Collection<String> getResponseHeaderNames()
    • addResponseHeader

      void addResponseHeader(String name, String value)
    • clearResponseHeaders

      void clearResponseHeaders()
    • getResponseHeader

      String getResponseHeader(String name)
      Gets the first response header with the given name
      Parameters:
      name - The header name
      Returns:
      The header value, or null if it is not present
    • setCompletedListener

      void setCompletedListener(CompletedListener listener)
    • setPreCommitListener

      void setPreCommitListener(PreCommitListener listener)
    • getRequestContentLength

      default long getRequestContentLength()
      Returns:
      The content length of the request, or -1 if it has not been set
    • getResponseContentLength

      default long getResponseContentLength()
      Returns:
      The content length of the response, or -1 if it has not been set
    • isUpgrade

      default boolean isUpgrade()
      Returns:
      True if this exchange represents an upgrade response
    • getRequestMethod

      String getRequestMethod()
      Get the HTTP request method
      Returns:
      the HTTP request method
    • getRequestScheme

      String getRequestScheme()
      Get the request URI scheme. Normally this is one of http or https.
      Returns:
      the request URI scheme
    • getRequestURI

      String getRequestURI()
      The original request URI. This will include the host name, getProtocol etc if it was specified by the client.

      This is not decoded in any way, and does not include the query string.

      Examples: GET http://localhost:8080/myFile.jsf?foo=bar HTTP/1.1 -> 'http://localhost:8080/myFile.jsf' POST /my+File.jsf?foo=bar HTTP/1.1 -> '/my+File.jsf'

    • getProtocol

      String getProtocol()
    • isInIoThread

      boolean isInIoThread()
    • isHttp2

      boolean isHttp2()
    • addWriteFunction

      void addWriteFunction(WriteFunction listener)
    • getOutputChannel

      OutputChannel getOutputChannel()
    • getInputChannel

      InputChannel getInputChannel()
    • getInputStream

      InputStream getInputStream()
    • getOutputStream

      OutputStream getOutputStream()
    • setBlockingHttpExchange

      void setBlockingHttpExchange(BlockingHttpExchange exchange)
    • getDestinationAddress

      InetSocketAddress getDestinationAddress()
    • getSourceAddress

      InetSocketAddress getSourceAddress()
    • isComplete

      boolean isComplete()
    • isRequestComplete

      boolean isRequestComplete()
      Returns true if all data has been read from the request, or if there was not data.
      Returns:
      true if the request is complete
    • isResponseComplete

      boolean isResponseComplete()
      Returns:
      true if the responses is complete
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getIoThread

      io.netty.util.concurrent.EventExecutor getIoThread()
    • setUpgradeListener

      void setUpgradeListener(Consumer<Object> listener)
    • getWorker

      Executor getWorker()
    • getUndertowOptions

      UndertowOptionMap getUndertowOptions()
    • setUndertowOptions

      void setUndertowOptions(UndertowOptionMap options)
    • sendContinue

      void sendContinue()
    • discardRequest

      void discardRequest()
    • isUpgradeSupported

      boolean isUpgradeSupported()
    • getSslSessionInfo

      SSLSessionInfo getSslSessionInfo()
    • isPushSupported

      default boolean isPushSupported()
    • isRequestTrailerFieldsSupported

      default boolean isRequestTrailerFieldsSupported()
    • isIoOperationQueued

      boolean isIoOperationQueued()
    • setMaxEntitySize

      void setMaxEntitySize(long maxEntitySize)
    • getMaxEntitySize

      long getMaxEntitySize()
    • setReadTimeout

      void setReadTimeout(long readTimeoutMs)
    • getReadTimeout

      long getReadTimeout()
    • endExchange

      void endExchange()
    • getResponseBytesSent

      long getResponseBytesSent()
    • pushResource

      default void pushResource(String path, String method, Map<String,List<String>> requestHeaders)