Package io.undertow.websockets.spi
Class AsyncWebSocketHttpServerExchange
java.lang.Object
io.undertow.websockets.spi.AsyncWebSocketHttpServerExchange
- All Implemented Interfaces:
WebSocketHttpExchange,Closeable,AutoCloseable
- Direct Known Subclasses:
BlockingWebSocketHttpServerExchange
- Author:
- Stuart Douglas
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncWebSocketHttpServerExchange(HttpServerExchange exchange, Set<WebSocketChannel> peerConnections) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Forcibly close the exchange.voidEnd the exchange normally.<T> TgetAttachment(AttachmentKey<T> key) org.xnio.OptionMapgetRequestHeader(String headerName) gets the first request header with the specified nameGet the request scheme, usually http or httpsgetResponseHeader(String headerName) get a response headerGets the session, if anybooleanisUserInRole(String role) <T> voidputAttachment(AttachmentKey<T> key, T value) org.xnio.IoFuture<byte[]>Gets the body of the request.org.xnio.IoFuture<Void>sendData(ByteBuffer data) Send some datavoidsetResponseHeader(String headerName, String headerValue) Set a response headervoidsetResponseHeaders(Map<String, List<String>> headers) Sets the response headersvoidupgradeChannel(HttpUpgradeListener upgradeCallback) Upgrade the underlying channel
-
Constructor Details
-
AsyncWebSocketHttpServerExchange
public AsyncWebSocketHttpServerExchange(HttpServerExchange exchange, Set<WebSocketChannel> peerConnections)
-
-
Method Details
-
putAttachment
- Specified by:
putAttachmentin interfaceWebSocketHttpExchange
-
getAttachment
- Specified by:
getAttachmentin interfaceWebSocketHttpExchange
-
getRequestHeader
Description copied from interface:WebSocketHttpExchangegets the first request header with the specified name- Specified by:
getRequestHeaderin interfaceWebSocketHttpExchange- Parameters:
headerName- The header name- Returns:
- The header value, or null
-
getRequestHeaders
- Specified by:
getRequestHeadersin interfaceWebSocketHttpExchange- Returns:
- An unmodifiable map of request headers
-
getResponseHeader
Description copied from interface:WebSocketHttpExchangeget a response header- Specified by:
getResponseHeaderin interfaceWebSocketHttpExchange- Parameters:
headerName- The header name- Returns:
- The header value, or null
-
getResponseHeaders
- Specified by:
getResponseHeadersin interfaceWebSocketHttpExchange- Returns:
- An unmodifiable map of response headers
-
setResponseHeaders
Description copied from interface:WebSocketHttpExchangeSets the response headers- Specified by:
setResponseHeadersin interfaceWebSocketHttpExchange
-
setResponseHeader
Description copied from interface:WebSocketHttpExchangeSet a response header- Specified by:
setResponseHeaderin interfaceWebSocketHttpExchange- Parameters:
headerName- The header nameheaderValue- The header value
-
upgradeChannel
Description copied from interface:WebSocketHttpExchangeUpgrade the underlying channel- Specified by:
upgradeChannelin interfaceWebSocketHttpExchange
-
sendData
Description copied from interface:WebSocketHttpExchangeSend some data- Specified by:
sendDatain interfaceWebSocketHttpExchange- Parameters:
data- The data
-
readRequestData
public org.xnio.IoFuture<byte[]> readRequestData()Description copied from interface:WebSocketHttpExchangeGets the body of the request.- Specified by:
readRequestDatain interfaceWebSocketHttpExchange
-
endExchange
public void endExchange()Description copied from interface:WebSocketHttpExchangeEnd the exchange normally. If this is a blocking exchange this may be a noop, and the exchange will actually end when the call stack returns- Specified by:
endExchangein interfaceWebSocketHttpExchange
-
close
public void close()Description copied from interface:WebSocketHttpExchangeForcibly close the exchange.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceWebSocketHttpExchange
-
getRequestScheme
Description copied from interface:WebSocketHttpExchangeGet the request scheme, usually http or https- Specified by:
getRequestSchemein interfaceWebSocketHttpExchange- Returns:
- The request scheme
-
getRequestURI
- Specified by:
getRequestURIin interfaceWebSocketHttpExchange- Returns:
- The request URI, including the query string
-
getBufferPool
- Specified by:
getBufferPoolin interfaceWebSocketHttpExchange- Returns:
- The buffer pool
-
getQueryString
- Specified by:
getQueryStringin interfaceWebSocketHttpExchange- Returns:
- The query string
-
getSession
Description copied from interface:WebSocketHttpExchangeGets the session, if any- Specified by:
getSessionin interfaceWebSocketHttpExchange- Returns:
- The session object, or null
-
getRequestParameters
- Specified by:
getRequestParametersin interfaceWebSocketHttpExchange
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfaceWebSocketHttpExchange
-
isUserInRole
- Specified by:
isUserInRolein interfaceWebSocketHttpExchange
-
getPeerConnections
- Specified by:
getPeerConnectionsin interfaceWebSocketHttpExchange
-
getOptions
public org.xnio.OptionMap getOptions()- Specified by:
getOptionsin interfaceWebSocketHttpExchange
-