Class ServletUpgradeRequest
- java.lang.Object
-
- org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest
-
- All Implemented Interfaces:
UpgradeRequest
- Direct Known Subclasses:
ServletWebSocketRequest
@Deprecated(since="2021-05-27") public class ServletUpgradeRequest extends Object implements UpgradeRequest
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.Servlet specificUpgradeRequest
implementation.
-
-
Constructor Summary
Constructors Constructor Description ServletUpgradeRequest(HttpServletRequest httpRequest)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addExtensions(String... configs)
Deprecated.Add WebSocket Extension Configuration(s) to requestvoid
addExtensions(ExtensionConfig... configs)
Deprecated.Add WebSocket Extension Configuration(s) to Upgrade Request.void
clearHeaders()
Deprecated.Remove all headers from request.void
complete()
Deprecated.X509Certificate[]
getCertificates()
Deprecated.List<HttpCookie>
getCookies()
Deprecated.Get the list of Cookies on the Upgrade requestList<ExtensionConfig>
getExtensions()
Deprecated.Get the list of WebSocket Extension Configurations for this Upgrade Request.String
getHeader(String name)
Deprecated.Get a specific Header value from Upgrade Requestint
getHeaderInt(String name)
Deprecated.Get the specific Header value, as anint
, from the Upgrade Request.Map<String,List<String>>
getHeaders()
Deprecated.Get the headers as a Map of keys to value lists.List<String>
getHeaders(String name)
Deprecated.Get the specific header values (for multi-value headers)String
getHost()
Deprecated.The host of the Upgrade Request URIHttpServletRequest
getHttpServletRequest()
Deprecated.Return the underlying HttpServletRequest that existed at Upgrade time.String
getHttpVersion()
Deprecated.The HTTP version used for this Upgrade RequestString
getLocalAddress()
Deprecated.Equivalent toServletRequest.getLocalAddr()
Locale
getLocale()
Deprecated.Equivalent toServletRequest.getLocale()
Enumeration<Locale>
getLocales()
Deprecated.Equivalent toServletRequest.getLocales()
String
getLocalHostName()
Deprecated.Equivalent toServletRequest.getLocalName()
int
getLocalPort()
Deprecated.Equivalent toServletRequest.getLocalPort()
InetSocketAddress
getLocalSocketAddress()
Deprecated.Return aInetSocketAddress
for the local socket.String
getMethod()
Deprecated.The HTTP method for this Upgrade Request.String
getOrigin()
Deprecated.The WebSocket Origin of this Upgrade RequestMap<String,List<String>>
getParameterMap()
Deprecated.Returns a map of the query parameters of the request.Principal
getPrincipal()
Deprecated.usegetUserPrincipal()
insteadString
getProtocolVersion()
Deprecated.Get the WebSocket Protocol VersionString
getQueryString()
Deprecated.Get the Query String of the request URI.String
getRemoteAddress()
Deprecated.Equivalent toServletRequest.getRemoteAddr()
String
getRemoteHostName()
Deprecated.Equivalent toServletRequest.getRemoteHost()
int
getRemotePort()
Deprecated.Equivalent toServletRequest.getRemotePort()
InetSocketAddress
getRemoteSocketAddress()
Deprecated.Return aInetSocketAddress
for the remote socket.String
getRequestPath()
Deprecated.URI
getRequestURI()
Deprecated.Get the Request URIObject
getServletAttribute(String name)
Deprecated.Map<String,Object>
getServletAttributes()
Deprecated.Map<String,List<String>>
getServletParameters()
Deprecated.HttpSession
getSession()
Deprecated.Return the HttpSession if it exists.List<String>
getSubProtocols()
Deprecated.Get the list of offered WebSocket sub-protocols.Principal
getUserPrincipal()
Deprecated.Equivalent toHttpServletRequest.getUserPrincipal()
boolean
hasSubProtocol(String test)
Deprecated.Test if a specific sub-protocol is offeredboolean
isOrigin(String test)
Deprecated.Test if supplied Origin is the same as the Requestboolean
isSecure()
Deprecated.Test if connection is secure.boolean
isUserInRole(String role)
Deprecated.void
setCookies(List<HttpCookie> cookies)
Deprecated.Set the list of Cookies on the requestvoid
setExtensions(List<ExtensionConfig> configs)
Deprecated.Set the list of WebSocket Extension configurations on the request.void
setHeader(String name, String value)
Deprecated.Set a specific header valuevoid
setHeader(String name, List<String> values)
Deprecated.Set a specific header with multi-value fieldvoid
setHeaders(Map<String,List<String>> headers)
Deprecated.Sets multiple headers on the request.void
setHttpVersion(String httpVersion)
Deprecated.Set the HTTP Version to use.void
setMethod(String method)
Deprecated.Set the HTTP method to use.void
setRequestURI(URI uri)
Deprecated.Set the Request URI to use for this request.void
setServletAttribute(String name, Object value)
Deprecated.void
setSession(Object session)
Deprecated.Set the Session associated with this request.void
setSubProtocols(String... protocols)
Deprecated.Set the offered WebSocket Sub-Protocol list.void
setSubProtocols(List<String> subProtocols)
Deprecated.Set the offered WebSocket Sub-Protocol list.
-
-
-
Constructor Detail
-
ServletUpgradeRequest
public ServletUpgradeRequest(HttpServletRequest httpRequest) throws URISyntaxException
Deprecated.- Throws:
URISyntaxException
-
-
Method Detail
-
addExtensions
public void addExtensions(ExtensionConfig... configs)
Deprecated.Description copied from interface:UpgradeRequest
Add WebSocket Extension Configuration(s) to Upgrade Request.This is merely the list of requested Extensions to use, see
UpgradeResponse.getExtensions()
for what was negotiated- Specified by:
addExtensions
in interfaceUpgradeRequest
- Parameters:
configs
- the configuration(s) to add
-
addExtensions
public void addExtensions(String... configs)
Deprecated.Description copied from interface:UpgradeRequest
Add WebSocket Extension Configuration(s) to requestThis is merely the list of requested Extensions to use, see
UpgradeResponse.getExtensions()
for what was negotiated- Specified by:
addExtensions
in interfaceUpgradeRequest
- Parameters:
configs
- the configuration(s) to add
-
clearHeaders
public void clearHeaders()
Deprecated.Description copied from interface:UpgradeRequest
Remove all headers from request.- Specified by:
clearHeaders
in interfaceUpgradeRequest
-
complete
public void complete()
Deprecated.
-
getCertificates
public X509Certificate[] getCertificates()
Deprecated.
-
getCookies
public List<HttpCookie> getCookies()
Deprecated.Description copied from interface:UpgradeRequest
Get the list of Cookies on the Upgrade request- Specified by:
getCookies
in interfaceUpgradeRequest
- Returns:
- the list of Cookies
-
getExtensions
public List<ExtensionConfig> getExtensions()
Deprecated.Description copied from interface:UpgradeRequest
Get the list of WebSocket Extension Configurations for this Upgrade Request.This is merely the list of requested Extensions to use, see
UpgradeResponse.getExtensions()
for what was negotiated- Specified by:
getExtensions
in interfaceUpgradeRequest
- Returns:
- the list of Extension configurations (in the order they were specified)
-
getHeader
public String getHeader(String name)
Deprecated.Description copied from interface:UpgradeRequest
Get a specific Header value from Upgrade Request- Specified by:
getHeader
in interfaceUpgradeRequest
- Parameters:
name
- the name of the header- Returns:
- the value of the header (null if header does not exist)
-
getHeaderInt
public int getHeaderInt(String name)
Deprecated.Description copied from interface:UpgradeRequest
Get the specific Header value, as anint
, from the Upgrade Request.- Specified by:
getHeaderInt
in interfaceUpgradeRequest
- Parameters:
name
- the name of the header- Returns:
- the value of the header as an
int
(-1 if header does not exist)
-
getHeaders
public Map<String,List<String>> getHeaders()
Deprecated.Description copied from interface:UpgradeRequest
Get the headers as a Map of keys to value lists.- Specified by:
getHeaders
in interfaceUpgradeRequest
- Returns:
- the headers
-
getHeaders
public List<String> getHeaders(String name)
Deprecated.Description copied from interface:UpgradeRequest
Get the specific header values (for multi-value headers)- Specified by:
getHeaders
in interfaceUpgradeRequest
- Parameters:
name
- the header name- Returns:
- the value list (null if no header exists)
-
getHost
public String getHost()
Deprecated.Description copied from interface:UpgradeRequest
The host of the Upgrade Request URI- Specified by:
getHost
in interfaceUpgradeRequest
- Returns:
- host of the request URI
-
getHttpServletRequest
public HttpServletRequest getHttpServletRequest()
Deprecated.Return the underlying HttpServletRequest that existed at Upgrade time.Note: many features of the HttpServletRequest are invalid when upgraded, especially ones that deal with body content, streams, readers, and responses.
- Returns:
- a limited version of the underlying HttpServletRequest
-
getHttpVersion
public String getHttpVersion()
Deprecated.Description copied from interface:UpgradeRequest
The HTTP version used for this Upgrade RequestAs of RFC6455 (December 2011) this is always
HTTP/1.1
- Specified by:
getHttpVersion
in interfaceUpgradeRequest
- Returns:
- the HTTP Version used
-
getLocalAddress
public String getLocalAddress()
Deprecated.Equivalent toServletRequest.getLocalAddr()
- Returns:
- the local address
-
getLocale
public Locale getLocale()
Deprecated.Equivalent toServletRequest.getLocale()
- Returns:
- the preferred
Locale
for the client
-
getLocales
public Enumeration<Locale> getLocales()
Deprecated.Equivalent toServletRequest.getLocales()
- Returns:
- an Enumeration of preferred Locale objects
-
getLocalHostName
public String getLocalHostName()
Deprecated.Equivalent toServletRequest.getLocalName()
- Returns:
- the local host name
-
getLocalPort
public int getLocalPort()
Deprecated.Equivalent toServletRequest.getLocalPort()
- Returns:
- the local port
-
getLocalSocketAddress
public InetSocketAddress getLocalSocketAddress()
Deprecated.Return aInetSocketAddress
for the local socket.Warning: this can cause a DNS lookup
- Returns:
- the local socket address
-
getMethod
public String getMethod()
Deprecated.Description copied from interface:UpgradeRequest
The HTTP method for this Upgrade Request.As of RFC6455 (December 2011) this is always
GET
- Specified by:
getMethod
in interfaceUpgradeRequest
- Returns:
- the HTTP method used
-
getOrigin
public String getOrigin()
Deprecated.Description copied from interface:UpgradeRequest
The WebSocket Origin of this Upgrade RequestSee RFC6455: Section 10.2 for details.
Equivalent to
UpgradeRequest.getHeader(String)
passed the "Origin" header.- Specified by:
getOrigin
in interfaceUpgradeRequest
- Returns:
- the Origin header
-
getParameterMap
public Map<String,List<String>> getParameterMap()
Deprecated.Description copied from interface:UpgradeRequest
Returns a map of the query parameters of the request.- Specified by:
getParameterMap
in interfaceUpgradeRequest
- Returns:
- a unmodifiable map of query parameters of the request.
-
getPrincipal
@Deprecated public Principal getPrincipal()
Deprecated.usegetUserPrincipal()
instead- Returns:
- the principal
-
getProtocolVersion
public String getProtocolVersion()
Deprecated.Description copied from interface:UpgradeRequest
Get the WebSocket Protocol VersionAs of RFC6455, Jetty only supports version
13
- Specified by:
getProtocolVersion
in interfaceUpgradeRequest
- Returns:
- the WebSocket protocol version
-
getQueryString
public String getQueryString()
Deprecated.Description copied from interface:UpgradeRequest
Get the Query String of the request URI.- Specified by:
getQueryString
in interfaceUpgradeRequest
- Returns:
- the request uri query string
-
getRemoteAddress
public String getRemoteAddress()
Deprecated.Equivalent toServletRequest.getRemoteAddr()
- Returns:
- the remote address
-
getRemoteHostName
public String getRemoteHostName()
Deprecated.Equivalent toServletRequest.getRemoteHost()
- Returns:
- the remote host name
-
getRemotePort
public int getRemotePort()
Deprecated.Equivalent toServletRequest.getRemotePort()
- Returns:
- the remote port
-
getRemoteSocketAddress
public InetSocketAddress getRemoteSocketAddress()
Deprecated.Return aInetSocketAddress
for the remote socket.Warning: this can cause a DNS lookup
- Returns:
- the remote socket address
-
getRequestPath
public String getRequestPath()
Deprecated.
-
getRequestURI
public URI getRequestURI()
Deprecated.Description copied from interface:UpgradeRequest
Get the Request URI- Specified by:
getRequestURI
in interfaceUpgradeRequest
- Returns:
- the request URI
-
getSession
public HttpSession getSession()
Deprecated.Return the HttpSession if it exists.Note: this is equivalent to
HttpServletRequest.getSession(boolean)
and will not create a new HttpSession.- Specified by:
getSession
in interfaceUpgradeRequest
- Returns:
- the Servlet HTTPSession on server side UpgradeRequests
-
getSubProtocols
public List<String> getSubProtocols()
Deprecated.Description copied from interface:UpgradeRequest
Get the list of offered WebSocket sub-protocols.- Specified by:
getSubProtocols
in interfaceUpgradeRequest
- Returns:
- the list of offered sub-protocols
-
getUserPrincipal
public Principal getUserPrincipal()
Deprecated.Equivalent toHttpServletRequest.getUserPrincipal()
- Specified by:
getUserPrincipal
in interfaceUpgradeRequest
- Returns:
- the user principal
-
hasSubProtocol
public boolean hasSubProtocol(String test)
Deprecated.Description copied from interface:UpgradeRequest
Test if a specific sub-protocol is offered- Specified by:
hasSubProtocol
in interfaceUpgradeRequest
- Parameters:
test
- the sub-protocol to test for- Returns:
- true if sub-protocol exists on request
-
isOrigin
public boolean isOrigin(String test)
Deprecated.Description copied from interface:UpgradeRequest
Test if supplied Origin is the same as the Request- Specified by:
isOrigin
in interfaceUpgradeRequest
- Parameters:
test
- the supplied origin- Returns:
- true if the supplied origin matches the request origin
-
isSecure
public boolean isSecure()
Deprecated.Description copied from interface:UpgradeRequest
Test if connection is secure.- Specified by:
isSecure
in interfaceUpgradeRequest
- Returns:
- true if connection is secure.
-
isUserInRole
public boolean isUserInRole(String role)
Deprecated.
-
setCookies
public void setCookies(List<HttpCookie> cookies)
Deprecated.Description copied from interface:UpgradeRequest
Set the list of Cookies on the request- Specified by:
setCookies
in interfaceUpgradeRequest
- Parameters:
cookies
- the cookies to use
-
setExtensions
public void setExtensions(List<ExtensionConfig> configs)
Deprecated.Description copied from interface:UpgradeRequest
Set the list of WebSocket Extension configurations on the request.- Specified by:
setExtensions
in interfaceUpgradeRequest
- Parameters:
configs
- the list of extension configurations
-
setHeader
public void setHeader(String name, List<String> values)
Deprecated.Description copied from interface:UpgradeRequest
Set a specific header with multi-value fieldOverrides any previous value for this named header
- Specified by:
setHeader
in interfaceUpgradeRequest
- Parameters:
name
- the name of the headervalues
- the multi-value field
-
setHeader
public void setHeader(String name, String value)
Deprecated.Description copied from interface:UpgradeRequest
Set a specific header valueOverrides any previous value for this named header
- Specified by:
setHeader
in interfaceUpgradeRequest
- Parameters:
name
- the header to setvalue
- the value to set it to
-
setHeaders
public void setHeaders(Map<String,List<String>> headers)
Deprecated.Description copied from interface:UpgradeRequest
Sets multiple headers on the request.Only sets those headers provided, does not remove headers that exist on request and are not provided in the parameter for this method.
Convenience method vs calling
UpgradeRequest.setHeader(String, List)
multiple times.- Specified by:
setHeaders
in interfaceUpgradeRequest
- Parameters:
headers
- the headers to set
-
setHttpVersion
public void setHttpVersion(String httpVersion)
Deprecated.Description copied from interface:UpgradeRequest
Set the HTTP Version to use.As of RFC6455 (December 2011) this should always be
HTTP/1.1
- Specified by:
setHttpVersion
in interfaceUpgradeRequest
- Parameters:
httpVersion
- the HTTP version to use.
-
setMethod
public void setMethod(String method)
Deprecated.Description copied from interface:UpgradeRequest
Set the HTTP method to use.As of RFC6455 (December 2011) this is always
GET
- Specified by:
setMethod
in interfaceUpgradeRequest
- Parameters:
method
- the HTTP method to use.
-
setRequestURI
public void setRequestURI(URI uri)
Deprecated.Description copied from interface:UpgradeRequest
Set the Request URI to use for this request.Must be an absolute URI with scheme
'ws'
or'wss'
- Specified by:
setRequestURI
in interfaceUpgradeRequest
- Parameters:
uri
- the Request URI
-
setSession
public void setSession(Object session)
Deprecated.Description copied from interface:UpgradeRequest
Set the Session associated with this request.Typically used to associate the Servlet HttpSession object.
- Specified by:
setSession
in interfaceUpgradeRequest
- Parameters:
session
- the session object to associate with this request
-
setSubProtocols
public void setSubProtocols(List<String> subProtocols)
Deprecated.Description copied from interface:UpgradeRequest
Set the offered WebSocket Sub-Protocol list.- Specified by:
setSubProtocols
in interfaceUpgradeRequest
- Parameters:
subProtocols
- the offered sub-protocol list
-
setSubProtocols
public void setSubProtocols(String... protocols)
Deprecated.Description copied from interface:UpgradeRequest
Set the offered WebSocket Sub-Protocol list.- Specified by:
setSubProtocols
in interfaceUpgradeRequest
- Parameters:
protocols
- the offered sub-protocol list
-
-