Package org.glassfish.tyrus.spi
Class UpgradeResponse
- java.lang.Object
-
- org.glassfish.tyrus.spi.UpgradeResponse
-
- All Implemented Interfaces:
jakarta.websocket.HandshakeResponse
public abstract class UpgradeResponse extends java.lang.Object implements jakarta.websocket.HandshakeResponseAbstraction for a HTTP upgrade response. A transport creates an implementation for this and usesWebSocketEngine.upgrade(org.glassfish.tyrus.spi.UpgradeRequest, org.glassfish.tyrus.spi.UpgradeResponse)method to upgrade the request.- Author:
- Pavel Bucek
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLOCATIONHeader containing a new URI whengetStatus().static java.lang.StringRETRY_AFTERHeader containing delay or date in which client can try to reconnect to the server.static java.lang.StringTRACING_HEADER_PREFIXPrefix of headers used for including tracing information into handshake response.static java.lang.StringWWW_AUTHENTICATEHeader containing challenge with authentication scheme and parameters.
-
Constructor Summary
Constructors Constructor Description UpgradeResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFirstHeaderValue(java.lang.String name)Gets the value of the response header with the given name.abstract java.lang.StringgetReasonPhrase()Get HTTP reason phrase.abstract intgetStatus()Get the current HTTP status code of this response.abstract voidsetReasonPhrase(java.lang.String reason)Set HTTP reason phrase.abstract voidsetStatus(int status)Set HTTP status code for this response.
-
-
-
Field Detail
-
WWW_AUTHENTICATE
public static final java.lang.String WWW_AUTHENTICATE
Header containing challenge with authentication scheme and parameters.- See Also:
- Constant Field Values
-
LOCATION
public static final java.lang.String LOCATION
Header containing a new URI whengetStatus().- See Also:
- Constant Field Values
-
RETRY_AFTER
public static final java.lang.String RETRY_AFTER
Header containing delay or date in which client can try to reconnect to the server.- See Also:
- Constant Field Values
-
TRACING_HEADER_PREFIX
public static final java.lang.String TRACING_HEADER_PREFIX
Prefix of headers used for including tracing information into handshake response.- See Also:
- Constant Field Values
-
-
Method Detail
-
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(java.lang.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 java.lang.String getReasonPhrase()
Get HTTP reason phrase.Warning: The Reason Phrase is removed from HTTP/2 and from Servlet 6.
-
getFirstHeaderValue
public final java.lang.String getFirstHeaderValue(java.lang.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)
-
-