Class RESTEndpoint.RESTEndpointBuilder

  • Enclosing class:
    RESTEndpoint

    public static class RESTEndpoint.RESTEndpointBuilder
    extends Object
    Build a RESTEndpoint
    • Constructor Detail

      • RESTEndpointBuilder

        public RESTEndpointBuilder()
    • Method Detail

      • getPath

        public String getPath()
        This is where we assemble the path (straightforward in itself) but substitute the realm. For a number of URLs we use, the realm is not involved (none of the OIDC calls use it) but for others (like the identity endpoint) it is very important. Unfortunately substituting it is painful as we can accidentally change

        path1/{REALM}/path2

        to

        path1//path2

        when the realm is undefined (i.e. it is the root realm), or even worse:

        path1///path2

        when the realm is set to "/".

        Returns:
        the carefully assembled path
      • path

        public RESTEndpoint.RESTEndpointBuilder path​(String incoming)
        Add the specified value to the path carefully. We must never end up gluing together two "/" characters (one from the end of the previous path and another from the start of the next path).
        Parameters:
        incoming - the value to append to the path.
        Returns:
        the rest call builder object for fluency.
      • parameter

        public RESTEndpoint.RESTEndpointBuilder parameter​(String name,
                                                          String value)
        Add the specified name/value pair to the list of parameters. The list of parameters is preserved in order, even though this technically may not be necessary.
        Parameters:
        name - the name of the parameter
        value - the value of the parameter
        Returns:
        the rest call builder object for added fluency
      • addModuleParameters

        public RESTEndpoint.RESTEndpointBuilder addModuleParameters()
        Add the auth index name and auth index value to the list of parameters.
        Returns:
        the current rest call builder object
      • postData

        public RESTEndpoint.RESTEndpointBuilder postData​(String s)
        Add HTTP POST data. No checking is done in the case where we're actually building a GET and the post data will still be written.
        Returns:
        the current rest call builder object
      • header

        public RESTEndpoint.RESTEndpointBuilder header​(String header,
                                                       String value)
        Add the name/value pair to the outgoing headers.
        Parameters:
        header - The header name
        value - The header value
        Returns:
        the current rest call builder object
      • apiVersion

        public RESTEndpoint.RESTEndpointBuilder apiVersion​(String apiVersion)
        Set the API version for this endpoint.
        Parameters:
        apiVersion - The specified API version
        Returns:
        the current rest call builder object
      • build

        public RESTEndpoint build()
        Build the rest endpoint object
        Returns:
        the built rest endpoint