Class ServerUpgradeRequest

java.lang.Object
org.eclipse.jetty.websocket.core.server.ServerUpgradeRequest

public class ServerUpgradeRequest extends Object
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.
  • Constructor Details

  • Method Details

    • getCertificates

      public X509Certificate[] getCertificates()
      Returns:
      The X509Certificate instance at request attribute "jakarta.servlet.request.X509Certificate" or null.
    • getCookies

      public List<HttpCookie> getCookies()
      Returns:
      Request cookies
      See Also:
      • HttpServletRequest.getCookies()
    • getExtensions

      public List<ExtensionConfig> getExtensions()
      Returns:
      The extensions offered
      See Also:
    • getHeader

      public String getHeader(String name)
      Parameters:
      name - Header name
      Returns:
      Header value or null
      See Also:
      • HttpServletRequest.getHeader(String)
    • getHeaderInt

      public int getHeaderInt(String name)
      Parameters:
      name - Header name
      Returns:
      Header value as integer or -1
      See Also:
      • HttpServletRequest.getHeader(String)
    • getHeadersMap

      public Map<String,List<String>> getHeadersMap()
      Returns:
      Map of headers
      See Also:
    • getHeaders

      public List<String> getHeaders(String name)
      Parameters:
      name - Header name
      Returns:
      List of header values or null
      See Also:
    • getHost

      public String getHost()
      Returns:
      The requested host
      See Also:
      • HttpServletRequest.getRequestURL()
    • getHttpServletRequest

      public jakarta.servlet.http.HttpServletRequest getHttpServletRequest()
      Returns:
      Immutable version of HttpServletRequest
    • getHttpVersion

      public String getHttpVersion()
      Returns:
      The HTTP protocol version
      See Also:
      • ServletRequest.getProtocol()
    • getLocale

      public Locale getLocale()
      Returns:
      The requested Locale
      See Also:
      • ServletRequest.getLocale()
    • getLocales

      public Enumeration<Locale> getLocales()
      Returns:
      The requested Locales
      See Also:
      • ServletRequest.getLocales()
    • getLocalSocketAddress

      public SocketAddress getLocalSocketAddress()
      Returns:
      The local requested address, which is typically an InetSocketAddress, but may be another derivation of SocketAddress
      See Also:
      • ServletRequest.getLocalAddr()
      • ServletRequest.getLocalPort()
    • getMethod

      public String getMethod()
      Returns:
      The requested method
      See Also:
      • HttpServletRequest.getMethod()
    • getOrigin

      public String getOrigin()
      Returns:
      The origin header value
    • getParameterMap

      public Map<String,List<String>> getParameterMap()
      Returns:
      The request parameter map
      See Also:
      • ServletRequest.getParameterMap()
    • getProtocolVersion

      public String getProtocolVersion()
      Returns:
      WebSocket protocol version from "Sec-WebSocket-Version" header
    • getQueryString

      public String getQueryString()
      Returns:
      The request query string
      See Also:
      • HttpServletRequest.getQueryString()
    • getRemoteSocketAddress

      public SocketAddress getRemoteSocketAddress()
      Returns:
      The remote request address, which is typically an InetSocketAddress, but may be another derivation of SocketAddress
      See Also:
      • ServletRequest.getRemoteAddr()
      • ServletRequest.getRemotePort()
    • getRequestPath

      public String getRequestPath()
      Returns:
      The request URI path within the context
    • getRequestURI

      public URI getRequestURI()
      Returns:
      The request URI
      See Also:
      • HttpServletRequest.getRequestURL()
    • getPathInContext

      public String getPathInContext()
      Returns:
      the path within the context, combination of the ServletPath with the PathInfo.
    • getServletAttribute

      public Object getServletAttribute(String name)
      Parameters:
      name - Attribute name
      Returns:
      Attribute value or null
      See Also:
      • ServletRequest.getAttribute(String)
    • getServletAttributes

      public Map<String,Object> getServletAttributes()
      Returns:
      Request attribute map
    • getServletParameters

      public Map<String,List<String>> getServletParameters()
      Returns:
      Request parameters
      See Also:
      • ServletRequest.getParameterMap()
    • getSession

      public jakarta.servlet.http.HttpSession getSession()
      Returns:
      The HttpSession, which may be null or invalidated
      See Also:
      • HttpServletRequest.getSession(boolean)
    • getSubProtocols

      public List<String> getSubProtocols()
      Returns:
      Get WebSocket negotiation offered sub protocols
    • getUserPrincipal

      public Principal getUserPrincipal()
      Returns:
      The User's Principal or null
      See Also:
      • HttpServletRequest.getUserPrincipal()
    • hasSubProtocol

      public boolean hasSubProtocol(String subprotocol)
      Parameters:
      subprotocol - A sub protocol name
      Returns:
      True if the sub protocol was offered
    • isSecure

      public boolean isSecure()
      Returns:
      True if the request is secure
      See Also:
      • ServletRequest.isSecure()
    • isUserInRole

      public boolean isUserInRole(String role)
      Parameters:
      role - The user role
      Returns:
      True if the requests user has the role
      See Also:
      • HttpServletRequest.isUserInRole(String)
    • setServletAttribute

      public void setServletAttribute(String name, Object value)
      Parameters:
      name - Attribute name
      value - Attribute value to set
      See Also:
      • ServletRequest.setAttribute(String, Object)