public class ServletWebSocketHttpExchange extends Object implements WebSocketHttpExchange
Constructor and Description |
---|
ServletWebSocketHttpExchange(HttpServletRequest request,
HttpServletResponse response,
Set<WebSocketChannel> peerConnections) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Forcibly close the exchange.
|
void |
endExchange()
End the exchange normally.
|
<T> T |
getAttachment(AttachmentKey<T> key) |
ByteBufferPool |
getBufferPool() |
OptionMap |
getOptions() |
Set<WebSocketChannel> |
getPeerConnections() |
String |
getQueryString() |
String |
getRequestHeader(String headerName)
gets the first request header with the specified name
|
Map<String,List<String>> |
getRequestHeaders() |
Map<String,List<String>> |
getRequestParameters() |
String |
getRequestScheme()
Get the request scheme, usually http or https
|
String |
getRequestURI() |
String |
getResponseHeader(String headerName)
get a response header
|
Map<String,List<String>> |
getResponseHeaders() |
Object |
getSession()
Gets the session, if any
|
Principal |
getUserPrincipal() |
boolean |
isUserInRole(String role) |
<T> void |
putAttachment(AttachmentKey<T> key,
T value) |
IoFuture<byte[]> |
readRequestData()
Gets the body of the request.
|
IoFuture<Void> |
sendData(ByteBuffer data)
Send some data
|
void |
setResponseHeader(String headerName,
String headerValue)
Set a response header
|
void |
setResponseHeaders(Map<String,List<String>> headers)
Sets the response headers
|
void |
upgradeChannel(HttpUpgradeListener upgradeCallback)
Upgrade the underlying channel
|
public ServletWebSocketHttpExchange(HttpServletRequest request, HttpServletResponse response, Set<WebSocketChannel> peerConnections)
public <T> void putAttachment(AttachmentKey<T> key, T value)
putAttachment
in interface WebSocketHttpExchange
public <T> T getAttachment(AttachmentKey<T> key)
getAttachment
in interface WebSocketHttpExchange
public String getRequestHeader(String headerName)
WebSocketHttpExchange
getRequestHeader
in interface WebSocketHttpExchange
headerName
- The header namepublic Map<String,List<String>> getRequestHeaders()
getRequestHeaders
in interface WebSocketHttpExchange
public String getResponseHeader(String headerName)
WebSocketHttpExchange
getResponseHeader
in interface WebSocketHttpExchange
headerName
- The header namepublic Map<String,List<String>> getResponseHeaders()
getResponseHeaders
in interface WebSocketHttpExchange
public void setResponseHeaders(Map<String,List<String>> headers)
WebSocketHttpExchange
setResponseHeaders
in interface WebSocketHttpExchange
public void setResponseHeader(String headerName, String headerValue)
WebSocketHttpExchange
setResponseHeader
in interface WebSocketHttpExchange
headerName
- The header nameheaderValue
- The header valuepublic void upgradeChannel(HttpUpgradeListener upgradeCallback)
WebSocketHttpExchange
upgradeChannel
in interface WebSocketHttpExchange
public IoFuture<Void> sendData(ByteBuffer data)
WebSocketHttpExchange
sendData
in interface WebSocketHttpExchange
data
- The datapublic IoFuture<byte[]> readRequestData()
WebSocketHttpExchange
readRequestData
in interface WebSocketHttpExchange
public void endExchange()
WebSocketHttpExchange
endExchange
in interface WebSocketHttpExchange
public void close()
WebSocketHttpExchange
close
in interface WebSocketHttpExchange
close
in interface Closeable
close
in interface AutoCloseable
public String getRequestScheme()
WebSocketHttpExchange
getRequestScheme
in interface WebSocketHttpExchange
public String getRequestURI()
getRequestURI
in interface WebSocketHttpExchange
public ByteBufferPool getBufferPool()
getBufferPool
in interface WebSocketHttpExchange
public String getQueryString()
getQueryString
in interface WebSocketHttpExchange
public Object getSession()
WebSocketHttpExchange
getSession
in interface WebSocketHttpExchange
public Map<String,List<String>> getRequestParameters()
getRequestParameters
in interface WebSocketHttpExchange
public Principal getUserPrincipal()
getUserPrincipal
in interface WebSocketHttpExchange
public boolean isUserInRole(String role)
isUserInRole
in interface WebSocketHttpExchange
public Set<WebSocketChannel> getPeerConnections()
getPeerConnections
in interface WebSocketHttpExchange
public OptionMap getOptions()
getOptions
in interface WebSocketHttpExchange
Copyright © 2017 JBoss by Red Hat. All rights reserved.