Class RESTEndpoint.RESTEndpointBuilder
- java.lang.Object
-
- com.sun.identity.install.tools.util.RESTEndpoint.RESTEndpointBuilder
-
- Enclosing class:
- RESTEndpoint
public static class RESTEndpoint.RESTEndpointBuilder extends Object
Build a RESTEndpoint
-
-
Constructor Summary
Constructors Constructor Description RESTEndpointBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RESTEndpoint.RESTEndpointBuilderaddModuleParameters()Add the auth index name and auth index value to the list of parameters.RESTEndpoint.RESTEndpointBuilderapiVersion(String apiVersion)Set the API version for this endpoint.RESTEndpointbuild()Build the rest endpoint objectRESTEndpoint.RESTEndpointBuilderget()Set the HTTP method to GET.StringgetPath()This is where we assemble the path (straightforward in itself) but substitute the realm.RESTEndpoint.RESTEndpointBuilderheader(String header, String value)Add the name/value pair to the outgoing headers.RESTEndpoint.RESTEndpointBuilderparameter(String name, String value)Add the specified name/value pair to the list of parameters.RESTEndpoint.RESTEndpointBuilderpath(String incoming)Add the specified value to the path carefully.RESTEndpoint.RESTEndpointBuilderpost()Set the HTTP method to POSTRESTEndpoint.RESTEndpointBuilderpostData(String s)Add HTTP POST data.RESTEndpoint.RESTEndpointBuilderrealm(String s)Add the specified realm.
-
-
-
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.
-
realm
public RESTEndpoint.RESTEndpointBuilder realm(String s)
Add the specified realm.- Parameters:
s- The realm.- 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 parametervalue- 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
-
get
public RESTEndpoint.RESTEndpointBuilder get()
Set the HTTP method to GET.- Returns:
- the current rest call builder object
-
post
public RESTEndpoint.RESTEndpointBuilder post()
Set the HTTP method to POST- 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 namevalue- 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
-
-