Top Fields Constructors Methods
io.undertow.servlet.websockets

public Class ServletWebSocketHttpExchange

extends Object
implements WebSocketHttpExchange
Class Inheritance
All Implemented Interfaces
io.undertow.websockets.spi.WebSocketHttpExchange, java.io.Closeable, java.lang.AutoCloseable
Imports
io.undertow.server.HttpServerExchange, .HttpUpgradeListener, io.undertow.util.AttachmentKey, io.undertow.websockets.core.WebSocketChannel, io.undertow.websockets.spi.WebSocketHttpExchange, org.xnio.FinishedIoFuture, .FutureResult, .IoFuture, .IoUtils, .OptionMap, io.undertow.connector.ByteBufferPool, jakarta.servlet.ServletInputStream, .ServletOutputStream, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, java.io.ByteArrayOutputStream, .IOException, java.nio.ByteBuffer, java.security.Principal, java.util.ArrayList, .Arrays, .Collection, .Collections, .Enumeration, .HashMap, .List, .Map, .Set, .TreeMap

Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private final HttpServerExchange
private final Set<WebSocketChannel>
private final HttpServletRequest
private final HttpServletResponse

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.close.

Forcibly close the exchange.

public void
public <T> T
public ByteBufferPool
public OptionMap
public Set<WebSocketChannel>
public String
public String
getRequestHeader(final String
The header name
headerName
)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestHeader.

gets the first request header with the specified name

public Map<String, List<String>>
public Map<String, List<String>>
public String
getRequestScheme()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestScheme.

Get the request scheme, usually http or https

public String
public String
getResponseHeader(final String
The header name
headerName
)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeader.

get a response header

public Map<String, List<String>>
public Object
public Principal
public boolean
public <T> void
public IoFuture<byte[]>
public IoFuture<Void>
public void
setResponseHeader(final String
The header name
headerName
,
final String
The header value
headerValue
)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.setResponseHeader.

Set a response header

public void
public void
upgradeChannel(final HttpUpgradeListener upgradeCallback)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.upgradeChannel.

Upgrade the underlying channel

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

exchangeback to summary
private final HttpServerExchange exchange
peerConnectionsback to summary
private final Set<WebSocketChannel> peerConnections
requestback to summary
private final HttpServletRequest request
responseback to summary
private final HttpServletResponse response

Constructor Detail

ServletWebSocketHttpExchangeback to summary
public ServletWebSocketHttpExchange(final HttpServletRequest request, final HttpServletResponse response, Set<WebSocketChannel> peerConnections)

Method Detail

closeback to summary
public void close()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.close.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.close.

Forcibly close the exchange.

Annotations
@Override
endExchangeback to summary
public void endExchange()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.endExchange.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.endExchange.

End 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

Annotations
@Override
getAttachmentback to summary
public <T> T getAttachment(final AttachmentKey<T> key)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getAttachment.

Annotations
@Override
getBufferPoolback to summary
public ByteBufferPool getBufferPool()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getBufferPool.

Returns:ByteBufferPool

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getBufferPool.

The buffer pool

Annotations
@Override
getOptionsback to summary
public OptionMap getOptions()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getOptions.

Annotations
@Override
getPeerConnectionsback to summary
public Set<WebSocketChannel> getPeerConnections()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getPeerConnections.

Annotations
@Override
getQueryStringback to summary
public String getQueryString()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getQueryString.

Returns:String

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getQueryString.

The query string

Annotations
@Override
getRequestHeaderback to summary
public String getRequestHeader(final String headerName)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestHeader.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getRequestHeader.

gets the first request header with the specified name

Parameters
headerName:String

The header name

Returns:String

The header value, or null

Annotations
@Override
getRequestHeadersback to summary
public Map<String, List<String>> getRequestHeaders()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestHeaders.

Returns:Map<String, List<String>>

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getRequestHeaders.

An unmodifiable map of request headers

Annotations
@Override
getRequestParametersback to summary
public Map<String, List<String>> getRequestParameters()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestParameters.

Annotations
@Override
getRequestSchemeback to summary
public String getRequestScheme()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestScheme.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getRequestScheme.

Get the request scheme, usually http or https

Returns:String

The request scheme

Annotations
@Override
getRequestURIback to summary
public String getRequestURI()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getRequestURI.

Returns:String

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getRequestURI.

The request URI, including the query string

Annotations
@Override
getResponseHeaderback to summary
public String getResponseHeader(final String headerName)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeader.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeader.

get a response header

Parameters
headerName:String

The header name

Returns:String

The header value, or null

Annotations
@Override
getResponseHeadersback to summary
public Map<String, List<String>> getResponseHeaders()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeaders.

Returns:Map<String, List<String>>

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getResponseHeaders.

An unmodifiable map of response headers

Annotations
@Override
getSessionback to summary
public Object getSession()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getSession.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.getSession.

Gets the session, if any

Returns:Object

The session object, or null

Annotations
@Override
getUserPrincipalback to summary
public Principal getUserPrincipal()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.getUserPrincipal.

Annotations
@Override
isUserInRoleback to summary
public boolean isUserInRole(String role)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.isUserInRole.

Annotations
@Override
putAttachmentback to summary
public <T> void putAttachment(final AttachmentKey<T> key, final T value)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.putAttachment.

Annotations
@Override
readRequestDataback to summary
public IoFuture<byte[]> readRequestData()

Implements io.undertow.websockets.spi.WebSocketHttpExchange.readRequestData.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.readRequestData.

Gets the body of the request.

Annotations
@Override
sendDataback to summary
public IoFuture<Void> sendData(final ByteBuffer data)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.sendData.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.sendData.

Send some data

Parameters
data:ByteBuffer

The data

Annotations
@Override
setResponseHeaderback to summary
public void setResponseHeader(final String headerName, final String headerValue)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.setResponseHeader.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.setResponseHeader.

Set a response header

Parameters
headerName:String

The header name

headerValue:String

The header value

Annotations
@Override
setResponseHeadersback to summary
public void setResponseHeaders(final Map<String, List<String>> headers)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.setResponseHeaders.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.setResponseHeaders.

Sets the response headers

Annotations
@Override
upgradeChannelback to summary
public void upgradeChannel(final HttpUpgradeListener upgradeCallback)

Implements io.undertow.websockets.spi.WebSocketHttpExchange.upgradeChannel.

Doc from io.undertow.websockets.spi.WebSocketHttpExchange.upgradeChannel.

Upgrade the underlying channel

Annotations
@Override