Package org.glassfish.tyrus.spi
Class UpgradeResponse
java.lang.Object
org.glassfish.tyrus.spi.UpgradeResponse
- All Implemented Interfaces:
HandshakeResponse
- Direct Known Subclasses:
TyrusUpgradeResponse
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 Summary
Modifier and TypeFieldDescriptionstatic final String
Header containing a new URI whengetStatus()
.static final String
Header containing delay or date in which client can try to reconnect to the server.static final String
Prefix of headers used for including tracing information into handshake response.static final String
Header containing challenge with authentication scheme and parameters.Fields inherited from interface jakarta.websocket.HandshakeResponse
SEC_WEBSOCKET_ACCEPT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal String
getFirstHeaderValue
(String name) Gets the value of the response header with the given name.abstract String
Get HTTP reason phrase.abstract int
Get the current HTTP status code of this response.abstract void
setReasonPhrase
(String reason) Set HTTP reason phrase.abstract void
setStatus
(int status) Set HTTP status code for this response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.websocket.HandshakeResponse
getHeaders
-
Field Details
-
WWW_AUTHENTICATE
Header containing challenge with authentication scheme and parameters.- See Also:
-
LOCATION
Header containing a new URI whengetStatus()
.- See Also:
-
RETRY_AFTER
Header containing delay or date in which client can try to reconnect to the server.- See Also:
-
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
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
Get HTTP reason phrase.Warning: The Reason Phrase is removed from HTTP/2 and from Servlet 6.
-
getFirstHeaderValue
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)
-