Package co.arago.hiro.client.websocket
Class AuthenticatedWebSocketHandler.Conf<T extends AuthenticatedWebSocketHandler.Conf<T>>
- java.lang.Object
-
- co.arago.hiro.client.websocket.AuthenticatedWebSocketHandler.Conf<T>
-
- Direct Known Subclasses:
ActionWebSocket.Conf,EventWebSocket.Conf
- Enclosing class:
- AuthenticatedWebSocketHandler
public abstract static class AuthenticatedWebSocketHandler.Conf<T extends AuthenticatedWebSocketHandler.Conf<T>> extends java.lang.ObjectConfiguration interface for all the parameters of an AuthenticatedAPIHandler. Builder need to implement this.
-
-
Constructor Summary
Constructors Constructor Description Conf()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AuthenticatedWebSocketHandlerbuild()java.lang.StringgetApiName()java.lang.StringgetEndpoint()intgetMaxRetries()java.lang.StringgetName()java.lang.StringgetProtocol()TokenAPIHandlergetTokenApiHandler()longgetWebSocketMessageTimeout()booleanisReconnectOnFailedSend()protected abstract Tself()TsetApiName(java.lang.String apiName)TsetEndpointAndProtocol(java.lang.String endpoint, java.lang.String protocol)Sets endpoint and protocol directly, omitting automatic endpoint detection via apiName.TsetFragment(java.lang.String fragment)For initial connection to the WebSocket.TsetHeaderParam(java.lang.String key, java.lang.String value)For initial connection to the WebSocket.TsetHeaders(HttpHeaderMap headers)For initial connection to the WebSocket.TsetHeaders(java.util.Map<java.lang.String,java.lang.String> headers)For initial connection to the WebSocket.TsetMaxRetries(int maxRetries)TsetName(java.lang.String name)TsetQuery(URIEncodedData query)For initial connection to the WebSocket.TsetQuery(java.util.Map<java.lang.String,java.lang.String> query)For initial connection to the WebSocket.TsetQueryParam(java.lang.String key, java.lang.String value)For initial connection to the WebSocket.TsetReconnectOnFailedSend(boolean reconnectOnFailedSend)Reset the websocket whenAuthenticatedWebSocketHandler.send(String)fails.TsetTokenApiHandler(TokenAPIHandler tokenAPIHandler)TsetWebSocketMessageTimeout(java.lang.Long webSocketMessageTimeout)
-
-
-
Method Detail
-
getName
public java.lang.String getName()
-
setName
public T setName(java.lang.String name)
- Parameters:
name- Set the name of this websocket. If this is not set, a default name will be created. This name will appear in logfiles.- Returns:
self()
-
getApiName
public java.lang.String getApiName()
-
setApiName
public T setApiName(java.lang.String apiName)
- Parameters:
apiName- Set the name of the api. This name will be used to determine the API endpoint entry in the data obtained via a call to /api/version.- Returns:
self()
-
getEndpoint
public java.lang.String getEndpoint()
-
setEndpointAndProtocol
public T setEndpointAndProtocol(java.lang.String endpoint, java.lang.String protocol)
Sets endpoint and protocol directly, omitting automatic endpoint detection via apiName.- Parameters:
endpoint- Set a custom endpoint.protocol- The protocol header for the websocket.- Returns:
self()
-
getProtocol
public java.lang.String getProtocol()
-
setQuery
public T setQuery(java.util.Map<java.lang.String,java.lang.String> query)
For initial connection to the WebSocket.- Parameters:
query- Map of query fields.- Returns:
self()
-
setQuery
public T setQuery(URIEncodedData query)
For initial connection to the WebSocket.- Parameters:
query- URIEncodedData of query fields.- Returns:
self()
-
setQueryParam
public T setQueryParam(java.lang.String key, java.lang.String value)
For initial connection to the WebSocket.- Parameters:
key- Name of the query parametervalue- Value of the query parameter- Returns:
self()
-
setHeaders
public T setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
For initial connection to the WebSocket.- Parameters:
headers- Map of header fields.- Returns:
self()
-
setHeaders
public T setHeaders(HttpHeaderMap headers)
For initial connection to the WebSocket.- Parameters:
headers- HttpHeaderMap of header fields.- Returns:
self()
-
setHeaderParam
public T setHeaderParam(java.lang.String key, java.lang.String value)
For initial connection to the WebSocket.- Parameters:
key- Name of the header parametervalue- Value of the header parameter- Returns:
self()
-
setFragment
public T setFragment(java.lang.String fragment)
For initial connection to the WebSocket.- Parameters:
fragment- The URI fragment.- Returns:
self()
-
getWebSocketMessageTimeout
public long getWebSocketMessageTimeout()
-
setWebSocketMessageTimeout
public T setWebSocketMessageTimeout(java.lang.Long webSocketMessageTimeout)
- Parameters:
webSocketMessageTimeout- Message timeout in ms. Default is 60000.- Returns:
self()
-
getMaxRetries
public int getMaxRetries()
-
setMaxRetries
public T setMaxRetries(int maxRetries)
- Parameters:
maxRetries- Max amount of retries when http errors are received.- Returns:
self()
-
getTokenApiHandler
public TokenAPIHandler getTokenApiHandler()
-
setTokenApiHandler
public T setTokenApiHandler(TokenAPIHandler tokenAPIHandler)
- Parameters:
tokenAPIHandler- The tokenAPIHandler for this API.- Returns:
self()
-
isReconnectOnFailedSend
public boolean isReconnectOnFailedSend()
-
setReconnectOnFailedSend
public T setReconnectOnFailedSend(boolean reconnectOnFailedSend)
Reset the websocket whenAuthenticatedWebSocketHandler.send(String)fails. The default is false - throw an Exception when all retries are exhausted.- Parameters:
reconnectOnFailedSend- The flag to set.- Returns:
self()
-
self
protected abstract T self()
-
build
public abstract AuthenticatedWebSocketHandler build()
-
-