Clients - http : RedirectClient

Provides redirect functionality for HTTP client remote functions.

Constructor

__init

(string url, ClientConfiguration config, FollowRedirects redirectConfig, HttpClient httpClient)

  • url string
  • Target service url

  • httpClient HttpClient
  • HTTP client for outbound HTTP requests

Remote Methods

forward

The forward() function is used to invoke an HTTP call with inbound request's HTTP verb.

execute

The execute() sends an HTTP request to a service with the specified HTTP verb. Redirect will be performed only for HTTP methods.

submit

Submits an HTTP request to a service with the specified HTTP verb. The submit() function does not give out a Response as the result, rather it returns an HttpFuture which can be used to do further interactions with the endpoint.

Methods

get

If the received response for the get() remote function is redirect eligible, redirect will be performed automatically by this get() function.

post

If the received response for the post() remote function is redirect eligible, redirect will be performed automatically by this post() function.

head

If the received response for the head() remote function is redirect eligible, redirect will be performed automatically by this head() function.

put

If the received response for the put() remote function is redirect eligible, redirect will be performed automatically by this put() function.

patch

If the received response for the patch() remote function is redirect eligible, redirect will be performed automatically by this patch() function.

delete

If the received response for the delete() remote function is redirect eligible, redirect will be performed automatically by this delete() function.

options

If the received response for the options() remote function is redirect eligible, redirect will be performed automatically by this options() function.

getResponse

Retrieves the Response for a previously submitted request.

hasPromise

Checks whether a PushPromise exists for a previously submitted request.

getNextPromise

Retrieves the next available PushPromise for a previously submitted request.

getPromisedResponse

Retrieves the promised server push Response message.

rejectPromise

Rejects a PushPromise. When a PushPromise is rejected, there is no chance of fetching a promised response using the rejected promise.

Fields

  • url string
  • Target service url

  • httpClient HttpClient
  • HTTP client for outbound HTTP requests

  • currentRedirectCount int 0
  • Current redirect count of the HTTP client

forward

(string path, Request request)

returns Response | ClientError

The forward() function is used to invoke an HTTP call with inbound request's HTTP verb.

Parameters

  • path string
  • Resource path

  • request Request
  • An HTTP inbound request message

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

execute

(string httpVerb, string path, RequestMessage message)

returns Response | ClientError

The execute() sends an HTTP request to a service with the specified HTTP verb. Redirect will be performed only for HTTP methods.

Parameters

  • httpVerb string
  • The HTTP verb value

  • path string
  • Resource path

  • message RequestMessage
  • An HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

submit

(string httpVerb, string path, RequestMessage message)

returns HttpFuture | ClientError

Submits an HTTP request to a service with the specified HTTP verb. The submit() function does not give out a Response as the result, rather it returns an HttpFuture which can be used to do further interactions with the endpoint.

Parameters

  • httpVerb string
  • The HTTP verb value

  • path string
  • The resource path

  • message RequestMessage
  • An HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (HttpFuture | ClientError)
  • An HttpFuture that represents an asynchronous service invocation, or an error if the submission fails

get

(string path, RequestMessage message)

returns Response | ClientError

If the received response for the get() remote function is redirect eligible, redirect will be performed automatically by this get() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage (default ())
  • An optional HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

post

(string path, RequestMessage message)

returns Response | ClientError

If the received response for the post() remote function is redirect eligible, redirect will be performed automatically by this post() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage
  • An HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

If the received response for the head() remote function is redirect eligible, redirect will be performed automatically by this head() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage (default ())
  • An optional HTTP outbound request message or or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

put

(string path, RequestMessage message)

returns Response | ClientError

If the received response for the put() remote function is redirect eligible, redirect will be performed automatically by this put() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage
  • An HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

patch

(string path, RequestMessage message)

returns Response | ClientError

If the received response for the patch() remote function is redirect eligible, redirect will be performed automatically by this patch() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage
  • An HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

delete

(string path, RequestMessage message)

returns Response | ClientError

If the received response for the delete() remote function is redirect eligible, redirect will be performed automatically by this delete() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage (default ())
  • An HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

options

(string path, RequestMessage message)

returns Response | ClientError

If the received response for the options() remote function is redirect eligible, redirect will be performed automatically by this options() function.

Parameters

  • path string
  • Resource path

  • message RequestMessage (default ())
  • An optional HTTP outbound request message or any payload of type string, xml, json, byte[], io:ReadableByteChannel or mime:Entity[]

  • Return Type

    (Response | ClientError)
  • The HTTP Response message, or an error if the invocation fails

getResponse

(HttpFuture httpFuture)

returns Response | ClientError

Retrieves the Response for a previously submitted request.

Parameters

  • httpFuture HttpFuture
  • The HttpFuture relates to a previous asynchronous invocation

  • Return Type

    (Response | ClientError)
  • An HTTP response message, or an error if the invocation fails

hasPromise

(HttpFuture httpFuture)

returns boolean

Checks whether a PushPromise exists for a previously submitted request.

Parameters

  • httpFuture HttpFuture
  • The HttpFuture relates to a previous asynchronous invocation

  • Return Type

    (boolean)
  • A boolean that represents whether a PushPromise exists

getNextPromise

(HttpFuture httpFuture)

returns PushPromise | ClientError

Retrieves the next available PushPromise for a previously submitted request.

Parameters

  • httpFuture HttpFuture
  • The HttpFuture relates to a previous asynchronous invocation

getPromisedResponse

(PushPromise promise)

returns Response | ClientError

Retrieves the promised server push Response message.

Parameters

  • Return Type

    (Response | ClientError)
  • A promised HTTP Response message, or an error if the invocation fails

rejectPromise

Rejects a PushPromise. When a PushPromise is rejected, there is no chance of fetching a promised response using the rejected promise.

Parameters