Package kong.unirest.core
Interface WebSocketRequest
-
- All Known Implementing Classes:
WebSocketRequestImpl
public interface WebSocketRequest
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WebSocketRequestaccept(java.lang.String value)The Accept header to send (e.g.WebSocketRequestbasicAuth(java.lang.String username, java.lang.String password)Basic auth credentialsWebSocketResponseconnect(java.net.http.WebSocket.Listener listener)WebSocketRequestcookie(java.lang.String name, java.lang.String value)Add a simple cookie headerWebSocketRequestcookie(java.util.Collection<Cookie> cookies)Add a collection of cookie headersWebSocketRequestcookie(Cookie cookie)Add a simple cookie headerHeadersgetHeaders()java.lang.StringgetUrl()WebSocketRequestheader(java.lang.String name, java.lang.String value)Add a http header, HTTP supports multiple of the same header.WebSocketRequestheaderReplace(java.lang.String name, java.lang.String value)Replace a header value or add it if it doesn't existWebSocketRequestheaders(java.util.Map<java.lang.String,java.lang.String> headerMap)Add headers as a mapWebSocketRequestqueryString(java.lang.String name, java.lang.Object value)add a query param to the url.WebSocketRequestqueryString(java.lang.String name, java.util.Collection<?> value)Add multiple param with the same param name.WebSocketRequestqueryString(java.util.Map<java.lang.String,java.lang.Object> parameters)Add query params as a map of name value pairsWebSocketRequestresponseEncoding(java.lang.String encoding)The encoding to expect the response to be for cases where the server fails to respond with the proper encodingWebSocketRequestrouteParam(java.lang.String name, java.lang.String value)add a route param that replaces the matching {name} For example routeParam("name", "fred") will replace {name} in https://localhost/users/{user} to https://localhost/users/fredWebSocketRequestrouteParam(java.util.Map<java.lang.String,java.lang.Object> params)add a route param map that replaces the matching {name} For example routeParam(Map.of("name", "fred")) will replace {name} in https://localhost/users/{user} to https://localhost/users/fred
-
-
-
Method Detail
-
routeParam
WebSocketRequest routeParam(java.lang.String name, java.lang.String value)
add a route param that replaces the matching {name} For example routeParam("name", "fred") will replace {name} in https://localhost/users/{user} to https://localhost/users/fred- Parameters:
name- the name of the param (do not include curly braces {}value- the value to replace the placeholder with- Returns:
- this request builder
-
routeParam
WebSocketRequest routeParam(java.util.Map<java.lang.String,java.lang.Object> params)
add a route param map that replaces the matching {name} For example routeParam(Map.of("name", "fred")) will replace {name} in https://localhost/users/{user} to https://localhost/users/fred- Parameters:
params- a map of path params- Returns:
- this request builder
-
basicAuth
WebSocketRequest basicAuth(java.lang.String username, java.lang.String password)
Basic auth credentials- Parameters:
username- the usernamepassword- the password- Returns:
- this request builder
-
accept
WebSocketRequest accept(java.lang.String value)
The Accept header to send (e.g. application/json- Parameters:
value- a valid mime type for the Accept header- Returns:
- this request builder
-
responseEncoding
WebSocketRequest responseEncoding(java.lang.String encoding)
The encoding to expect the response to be for cases where the server fails to respond with the proper encoding- Parameters:
encoding- a valid mime type for the Accept header- Returns:
- this request builder
-
header
WebSocketRequest header(java.lang.String name, java.lang.String value)
Add a http header, HTTP supports multiple of the same header. This will continue to append new values- Parameters:
name- name of the headervalue- value for the header- Returns:
- this request builder
-
headerReplace
WebSocketRequest headerReplace(java.lang.String name, java.lang.String value)
Replace a header value or add it if it doesn't exist- Parameters:
name- name of the headervalue- value for the header- Returns:
- this request builder
-
headers
WebSocketRequest headers(java.util.Map<java.lang.String,java.lang.String> headerMap)
Add headers as a map- Parameters:
headerMap- a map of headers- Returns:
- this request builder
-
cookie
WebSocketRequest cookie(java.lang.String name, java.lang.String value)
Add a simple cookie header- Parameters:
name- the name of the cookievalue- the value of the cookie- Returns:
- this request builder
-
cookie
WebSocketRequest cookie(Cookie cookie)
Add a simple cookie header- Parameters:
cookie- a cookie- Returns:
- this request builder
-
cookie
WebSocketRequest cookie(java.util.Collection<Cookie> cookies)
Add a collection of cookie headers- Parameters:
cookies- a cookie- Returns:
- this request builder
-
queryString
WebSocketRequest queryString(java.lang.String name, java.lang.Object value)
add a query param to the url. The value will be URL-Encoded- Parameters:
name- the name of the paramvalue- the value of the param- Returns:
- this request builder
-
queryString
WebSocketRequest queryString(java.lang.String name, java.util.Collection<?> value)
Add multiple param with the same param name. queryString("name", Arrays.asList("bob", "linda")) will result in ?name=bob&name=linda- Parameters:
name- the name of the paramvalue- a collection of values- Returns:
- this request builder
-
queryString
WebSocketRequest queryString(java.util.Map<java.lang.String,java.lang.Object> parameters)
Add query params as a map of name value pairs- Parameters:
parameters- a map of params- Returns:
- this request builder
-
connect
WebSocketResponse connect(java.net.http.WebSocket.Listener listener)
-
getHeaders
Headers getHeaders()
-
getUrl
java.lang.String getUrl()
-
-