Class ServerUpgradeRequestImpl
java.lang.Object
org.eclipse.jetty.server.Request.Wrapper
org.eclipse.jetty.websocket.core.server.internal.ServerUpgradeRequestImpl
- All Implemented Interfaces:
Content.Source,Request,Attributes,ServerUpgradeRequest
Upgrade request used for websocket negotiation.
Provides getters for things like the requested extensions and subprotocols so that the headers don't have to be parsed manually.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.SyntheticNested classes/interfaces inherited from interface org.eclipse.jetty.server.Request
Request.AttributesWrapper, Request.AuthenticationState, Request.Handler, Request.ServeAs, Request.Wrapper -
Field Summary
Fields inherited from interface org.eclipse.jetty.util.Attributes
NULLFields inherited from interface org.eclipse.jetty.server.Request
COOKIE_ATTRIBUTE, DEFAULT_LOCALES, LOG -
Constructor Summary
ConstructorsConstructorDescriptionServerUpgradeRequestImpl(WebSocketNegotiation negotiation, Request baseRequest) -
Method Summary
Modifier and TypeMethodDescriptionvoidClear all attribute namesgetAttribute(String name) Get an attributeGet the immutable set of attribute names.booleanhasSubProtocol(String subprotocol) removeAttribute(String name) Remove an attributesetAttribute(String name, Object attribute) Set an attributevoidupgrade(Attributes attributes) Methods inherited from class org.eclipse.jetty.server.Request.Wrapper
addFailureListener, addHttpStreamWrapper, addIdleTimeoutListener, asAttributeMap, consumeAvailable, demand, fail, getBeginNanoTime, getComponents, getConnectionMetaData, getContext, getHeaders, getHeadersNanoTime, getHttpURI, getId, getLength, getMethod, getSession, getTrailers, getTunnelSupport, getWrapped, isSecure, push, read, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, equals, hashCodeMethods inherited from interface org.eclipse.jetty.io.Content.Source
fail, fail, getLength, rewindMethods inherited from interface org.eclipse.jetty.server.Request
addFailureListener, addHttpStreamWrapper, addIdleTimeoutListener, consumeAvailable, demand, getBeginNanoTime, getComponents, getConnectionMetaData, getContext, getHeaders, getHeadersNanoTime, getHttpURI, getId, getMethod, getSession, getTrailers, getTunnelSupport, isSecure, push, read
-
Constructor Details
-
ServerUpgradeRequestImpl
public ServerUpgradeRequestImpl(WebSocketNegotiation negotiation, Request baseRequest) throws BadMessageException - Throws:
BadMessageException
-
-
Method Details
-
getWebSocketComponents
- Specified by:
getWebSocketComponentsin interfaceServerUpgradeRequest
-
upgrade
- Specified by:
upgradein interfaceServerUpgradeRequest
-
removeAttribute
Description copied from interface:AttributesRemove an attribute- Specified by:
removeAttributein interfaceAttributes- Overrides:
removeAttributein classRequest.Wrapper- Parameters:
name- the attribute to remove- Returns:
- the value of the attribute if removed, else
null
-
setAttribute
Description copied from interface:AttributesSet an attribute- Specified by:
setAttributein interfaceAttributes- Overrides:
setAttributein classRequest.Wrapper- Parameters:
name- the attribute to setattribute- the value to set. A null value is equivalent to removing the attribute.- Returns:
- the previous value of the attribute if set, else
null
-
getAttribute
Description copied from interface:AttributesGet an attribute- Specified by:
getAttributein interfaceAttributes- Overrides:
getAttributein classRequest.Wrapper- Parameters:
name- the attribute to get- Returns:
- the value of the attribute, or
nullif no such attribute exists
-
getAttributeNameSet
Description copied from interface:AttributesGet the immutable set of attribute names.- Specified by:
getAttributeNameSetin interfaceAttributes- Overrides:
getAttributeNameSetin classRequest.Wrapper- Returns:
- Set of attribute names, or an empty set if there are no attributes.
-
clearAttributes
public void clearAttributes()Description copied from interface:AttributesClear all attribute names- Specified by:
clearAttributesin interfaceAttributes- Overrides:
clearAttributesin classRequest.Wrapper
-
getExtensions
- Specified by:
getExtensionsin interfaceServerUpgradeRequest- Returns:
- The extensions offered
-
getProtocolVersion
- Specified by:
getProtocolVersionin interfaceServerUpgradeRequest- Returns:
- WebSocket protocol version from "Sec-WebSocket-Version" header
-
getSubProtocols
- Specified by:
getSubProtocolsin interfaceServerUpgradeRequest- Returns:
- Get WebSocket negotiation offered sub protocols
-
hasSubProtocol
- Specified by:
hasSubProtocolin interfaceServerUpgradeRequest- Parameters:
subprotocol- A sub protocol name- Returns:
- True if the sub protocol was offered
-