Class WebSocketRequestImpl

    • Field Detail

      • creation

        private java.time.Instant creation
      • objectMapper

        private java.util.Optional<ObjectMapper> objectMapper
      • responseEncoding

        private java.lang.String responseEncoding
      • headers

        protected Headers headers
      • config

        protected final Config config
      • url

        protected Path url
      • connectTimeout

        private java.lang.Integer connectTimeout
    • Constructor Detail

      • WebSocketRequestImpl

        public WebSocketRequestImpl​(Config config,
                                    java.lang.String url)
    • Method Detail

      • routeParam

        public WebSocketRequest routeParam​(java.lang.String name,
                                           java.lang.String value)
        Description copied from interface: WebSocketRequest
        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
        Specified by:
        routeParam in interface WebSocketRequest
        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

        public WebSocketRequest routeParam​(java.util.Map<java.lang.String,​java.lang.Object> params)
        Description copied from interface: WebSocketRequest
        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
        Specified by:
        routeParam in interface WebSocketRequest
        Parameters:
        params - a map of path params
        Returns:
        this request builder
      • basicAuth

        public WebSocketRequest basicAuth​(java.lang.String username,
                                          java.lang.String password)
        Description copied from interface: WebSocketRequest
        Basic auth credentials
        Specified by:
        basicAuth in interface WebSocketRequest
        Parameters:
        username - the username
        password - the password
        Returns:
        this request builder
      • accept

        public WebSocketRequest accept​(java.lang.String value)
        Description copied from interface: WebSocketRequest
        The Accept header to send (e.g. application/json
        Specified by:
        accept in interface WebSocketRequest
        Parameters:
        value - a valid mime type for the Accept header
        Returns:
        this request builder
      • responseEncoding

        public WebSocketRequest responseEncoding​(java.lang.String encoding)
        Description copied from interface: WebSocketRequest
        The encoding to expect the response to be for cases where the server fails to respond with the proper encoding
        Specified by:
        responseEncoding in interface WebSocketRequest
        Parameters:
        encoding - a valid mime type for the Accept header
        Returns:
        this request builder
      • header

        public WebSocketRequest header​(java.lang.String name,
                                       java.lang.String value)
        Description copied from interface: WebSocketRequest
        Add a http header, HTTP supports multiple of the same header. This will continue to append new values
        Specified by:
        header in interface WebSocketRequest
        Parameters:
        name - name of the header
        value - value for the header
        Returns:
        this request builder
      • headerReplace

        public WebSocketRequest headerReplace​(java.lang.String name,
                                              java.lang.String value)
        Description copied from interface: WebSocketRequest
        Replace a header value or add it if it doesn't exist
        Specified by:
        headerReplace in interface WebSocketRequest
        Parameters:
        name - name of the header
        value - value for the header
        Returns:
        this request builder
      • headers

        public WebSocketRequest headers​(java.util.Map<java.lang.String,​java.lang.String> headerMap)
        Description copied from interface: WebSocketRequest
        Add headers as a map
        Specified by:
        headers in interface WebSocketRequest
        Parameters:
        headerMap - a map of headers
        Returns:
        this request builder
      • cookie

        public WebSocketRequest cookie​(java.lang.String name,
                                       java.lang.String value)
        Description copied from interface: WebSocketRequest
        Add a simple cookie header
        Specified by:
        cookie in interface WebSocketRequest
        Parameters:
        name - the name of the cookie
        value - the value of the cookie
        Returns:
        this request builder
      • queryString

        public WebSocketRequest queryString​(java.lang.String name,
                                            java.lang.Object value)
        Description copied from interface: WebSocketRequest
        add a query param to the url. The value will be URL-Encoded
        Specified by:
        queryString in interface WebSocketRequest
        Parameters:
        name - the name of the param
        value - the value of the param
        Returns:
        this request builder
      • queryString

        public WebSocketRequest queryString​(java.lang.String name,
                                            java.util.Collection<?> value)
        Description copied from interface: WebSocketRequest
        Add multiple param with the same param name. queryString("name", Arrays.asList("bob", "linda")) will result in ?name=bob&name=linda
        Specified by:
        queryString in interface WebSocketRequest
        Parameters:
        name - the name of the param
        value - a collection of values
        Returns:
        this request builder
      • queryString

        public WebSocketRequest queryString​(java.util.Map<java.lang.String,​java.lang.Object> parameters)
        Description copied from interface: WebSocketRequest
        Add query params as a map of name value pairs
        Specified by:
        queryString in interface WebSocketRequest
        Parameters:
        parameters - a map of params
        Returns:
        this request builder