com.atlassian.httpclient.api
Interface ResponseTransformation.Builder<T>

All Superinterfaces:
Buildable<ResponseTransformation<T>>
Enclosing interface:
ResponseTransformation<T>

public static interface ResponseTransformation.Builder<T>
extends Buildable<ResponseTransformation<T>>


Method Summary
 ResponseTransformation.Builder<T> badRequest(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'bad request' (400) HTTP responses.
 ResponseTransformation.Builder<T> clientError(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'client error' (4xx) HTTP responses.
 ResponseTransformation.Builder<T> conflict(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'conflict' (409) HTTP responses.
 ResponseTransformation.Builder<T> created(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'created' (201) HTTP responses.
 ResponseTransformation.Builder<T> done(com.google.common.base.Function<Response,T> f)
          Register a function to transform all completed (1xx, 2xx, 3xx, 4xx, and 5xx) HTTP responses.
 ResponseTransformation.Builder<T> error(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform all error (4xx and 5xx) HTTP responses.
 ResponseTransformation.Builder<T> fail(com.google.common.base.Function<Throwable,? extends T> f)
          Register a function to transform exceptions thrown while executing the HTTP request.
 ResponseTransformation.Builder<T> forbidden(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'forbidden' (403) HTTP responses.
 ResponseTransformation.Builder<T> informational(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'informational' (1xx) HTTP responses.
 ResponseTransformation.Builder<T> internalServerError(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'internal server error' (500) HTTP responses.
 ResponseTransformation.Builder<T> noContent(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'no content' (204) HTTP responses.
 ResponseTransformation.Builder<T> notFound(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'not found' (404) HTTP responses.
 ResponseTransformation.Builder<T> notModified(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'not modified' (304) HTTP responses.
 ResponseTransformation.Builder<T> notSuccessful(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform all non-'successful' (1xx, 3xx, 4xx, 5xx) HTTP responses.
 ResponseTransformation.Builder<T> ok(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'ok' (200) HTTP responses.
 ResponseTransformation.Builder<T> on(HttpStatus status, com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform HTTP responses with a specific status.
 ResponseTransformation.Builder<T> on(int statusCode, com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform HTTP responses with a specific status code.
 ResponseTransformation.Builder<T> others(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform all other HTTP responses (i.e.
 ResponseTransformation.Builder<T> otherwise(com.google.common.base.Function<Throwable,T> f)
          Register a function to transform both of the following events: Any value passed to fail() Any value passed to others(), converted into an exception
 ResponseTransformation.Builder<T> redirection(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'redirection' (3xx) HTTP responses.
 ResponseTransformation.Builder<T> seeOther(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'see other' (303) HTTP responses.
 ResponseTransformation.Builder<T> serverError(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'server error' (5xx) HTTP responses.
 ResponseTransformation.Builder<T> serviceUnavailable(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'service unavailable' (503) HTTP responses.
 ResponseTransformation.Builder<T> successful(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'successful' (2xx) HTTP responses.
 ResponseTransformation.Builder<T> unauthorized(com.google.common.base.Function<Response,? extends T> f)
          Register a function to transform 'unauthorized' (401) HTTP responses.
 
Methods inherited from interface com.atlassian.httpclient.api.Buildable
build
 

Method Detail

on

ResponseTransformation.Builder<T> on(HttpStatus status,
                                     com.google.common.base.Function<Response,? extends T> f)
Register a function to transform HTTP responses with a specific status. Use this as a fallback if the status code you're interested in does not have a more explicit registration method for it.

Parameters:
status - The HTTP status to select on
f - The transformation function
Returns:
This instance for chaining
See Also:
on(int, com.google.common.base.Function)

on

ResponseTransformation.Builder<T> on(int statusCode,
                                     com.google.common.base.Function<Response,? extends T> f)

Register a function to transform HTTP responses with a specific status code. Use this as a fallback if the status code you're interested in does not have a more explicit registration method for it.

Prefer the on(HttpStatus, com.google.common.base.Function) method if you're using standard HTTP status.

Parameters:
statusCode - The code to select on
f - The transformation function
Returns:
This instance for chaining
See Also:
on(HttpStatus, com.google.common.base.Function)

informational

ResponseTransformation.Builder<T> informational(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'informational' (1xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

successful

ResponseTransformation.Builder<T> successful(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'successful' (2xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

ok

ResponseTransformation.Builder<T> ok(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'ok' (200) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

created

ResponseTransformation.Builder<T> created(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'created' (201) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

noContent

ResponseTransformation.Builder<T> noContent(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'no content' (204) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

redirection

ResponseTransformation.Builder<T> redirection(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'redirection' (3xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

seeOther

ResponseTransformation.Builder<T> seeOther(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'see other' (303) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

notModified

ResponseTransformation.Builder<T> notModified(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'not modified' (304) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

clientError

ResponseTransformation.Builder<T> clientError(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'client error' (4xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

badRequest

ResponseTransformation.Builder<T> badRequest(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'bad request' (400) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

unauthorized

ResponseTransformation.Builder<T> unauthorized(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'unauthorized' (401) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

forbidden

ResponseTransformation.Builder<T> forbidden(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'forbidden' (403) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

notFound

ResponseTransformation.Builder<T> notFound(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'not found' (404) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

conflict

ResponseTransformation.Builder<T> conflict(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'conflict' (409) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

serverError

ResponseTransformation.Builder<T> serverError(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'server error' (5xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

internalServerError

ResponseTransformation.Builder<T> internalServerError(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'internal server error' (500) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

serviceUnavailable

ResponseTransformation.Builder<T> serviceUnavailable(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform 'service unavailable' (503) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

error

ResponseTransformation.Builder<T> error(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform all error (4xx and 5xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

notSuccessful

ResponseTransformation.Builder<T> notSuccessful(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform all non-'successful' (1xx, 3xx, 4xx, 5xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

others

ResponseTransformation.Builder<T> others(com.google.common.base.Function<Response,? extends T> f)
Register a function to transform all other HTTP responses (i.e. those not explicitly registered for).

Parameters:
f - The transformation function
Returns:
This instance for chaining

otherwise

ResponseTransformation.Builder<T> otherwise(com.google.common.base.Function<Throwable,T> f)
Register a function to transform both of the following events:

Parameters:
f - The transformation function
Returns:
This instance for chaining

done

ResponseTransformation.Builder<T> done(com.google.common.base.Function<Response,T> f)
Register a function to transform all completed (1xx, 2xx, 3xx, 4xx, and 5xx) HTTP responses.

Parameters:
f - The transformation function
Returns:
This instance for chaining

fail

ResponseTransformation.Builder<T> fail(com.google.common.base.Function<Throwable,? extends T> f)
Register a function to transform exceptions thrown while executing the HTTP request.

Parameters:
f - The transformation function
Returns:
This instance for chaining


Copyright © 2012–2015 Atlassian. All rights reserved.