Class UpgradeResponse

java.lang.Object
org.glassfish.tyrus.spi.UpgradeResponse
All Implemented Interfaces:
HandshakeResponse
Direct Known Subclasses:
TyrusUpgradeResponse

public abstract class UpgradeResponse extends Object implements HandshakeResponse
Abstraction for a HTTP upgrade response. A transport creates an implementation for this and uses WebSocketEngine.upgrade(org.glassfish.tyrus.spi.UpgradeRequest, org.glassfish.tyrus.spi.UpgradeResponse) method to upgrade the request.
Author:
Pavel Bucek
  • Field Details

    • WWW_AUTHENTICATE

      public static final String WWW_AUTHENTICATE
      Header containing challenge with authentication scheme and parameters.
      See Also:
    • LOCATION

      public static final String LOCATION
      Header containing a new URI when getStatus() .
      See Also:
    • RETRY_AFTER

      public static final String RETRY_AFTER
      Header containing delay or date in which client can try to reconnect to the server.
      See Also:
    • TRACING_HEADER_PREFIX

      public static final String TRACING_HEADER_PREFIX
      Prefix of headers used for including tracing information into handshake response.
      See Also:
  • Constructor Details

    • UpgradeResponse

      public UpgradeResponse()
  • Method Details

    • getStatus

      public abstract int getStatus()
      Get the current HTTP status code of this response.
      Returns:
      the current HTTP status code.
    • setStatus

      public abstract void setStatus(int status)
      Set HTTP status code for this response.
      Parameters:
      status - HTTP status code for this response.
    • setReasonPhrase

      public abstract void setReasonPhrase(String reason)
      Set HTTP reason phrase.

      Warning: The Reason Phrase is removed from HTTP/2 and from Servlet 6.

      Parameters:
      reason - reason phrase to be set.
    • getReasonPhrase

      public abstract String getReasonPhrase()
      Get HTTP reason phrase.

      Warning: The Reason Phrase is removed from HTTP/2 and from Servlet 6.

    • getFirstHeaderValue

      public final String getFirstHeaderValue(String name)
      Gets the value of the response header with the given name.

      If a response header with the given name exists and contains multiple values, the value that was added first will be returned.

      Parameters:
      name - header name.
      Returns:
      the value of the response header with the given name, null if no header with the given name has been set on this response. TODO rename to getHeader(String name) ?? similar to TODO HttpServletResponse#getHeader(String)