Package org.glassfish.tyrus.spi
Class UpgradeResponse
- java.lang.Object
-
- org.glassfish.tyrus.spi.UpgradeResponse
-
- All Implemented Interfaces:
HandshakeResponse
- Direct Known Subclasses:
TyrusUpgradeResponse
public abstract class UpgradeResponse extends java.lang.Object implements HandshakeResponse
Abstraction 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 (pavel.bucek at oracle.com)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LOCATION
Header containing a new URI whengetStatus()
.static java.lang.String
RETRY_AFTER
Header containing delay or date in which client can try to reconnect to the server.static java.lang.String
TRACING_HEADER_PREFIX
Prefix of headers used for including tracing information into handshake response.static java.lang.String
WWW_AUTHENTICATE
Header containing challenge with authentication scheme and parameters.-
Fields inherited from interface javax.websocket.HandshakeResponse
SEC_WEBSOCKET_ACCEPT
-
-
Constructor Summary
Constructors Constructor Description UpgradeResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFirstHeaderValue(java.lang.String name)
Gets the value of the response header with the given name.abstract int
getStatus()
Get the current HTTP status code of this response.abstract void
setReasonPhrase(java.lang.String reason)
Get 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 javax.websocket.HandshakeResponse
getHeaders
-
-
-
-
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)
Get HTTP reason phrase.TODO remove ?? we are using only for "Switching Protocols" and that is TODO standard status code 101
- Parameters:
reason
- reason phrase to be set.
-
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)
-
-