|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
O - The target object for the transformation.public interface ResponseTransformation<O>
Transforms the ResponsePromise into a target object, allowing for transforming functions based on different
HTTP codes or exceptions. Under the covers, all functions are used in a fold() call.
| Method Summary | |
|---|---|
ResponseTransformation<O> |
badRequest(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'bad request' (400) HTTP responses. |
O |
claim()
Blocks the thread waiting for a result. |
ResponseTransformation<O> |
clientError(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'client error' (4xx) HTTP responses. |
ResponseTransformation<O> |
conflict(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'conflict' (409) HTTP responses. |
ResponseTransformation<O> |
created(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'created' (201) HTTP responses. |
ResponseTransformation<O> |
done(com.google.common.base.Function<Response,O> f)
Register a function to transform all completed (1xx, 2xx, 3xx, 4xx, and 5xx) HTTP responses. |
ResponseTransformation<O> |
error(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform all error (4xx and 5xx) HTTP responses. |
ResponseTransformation<O> |
fail(com.google.common.base.Function<java.lang.Throwable,? extends O> f)
Register a function to transform exceptions thrown while executing the HTTP request. |
ResponseTransformation<O> |
forbidden(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'forbidden' (403) HTTP responses. |
ResponseTransformation<O> |
informational(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'informational' (1xx) HTTP responses. |
ResponseTransformation<O> |
internalServerError(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'internal server error' (500) HTTP responses. |
ResponseTransformation<O> |
noContent(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'no content' (204) HTTP responses. |
ResponseTransformation<O> |
notFound(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'not found' (404) HTTP responses. |
ResponseTransformation<O> |
notModified(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'not modified' (304) HTTP responses. |
ResponseTransformation<O> |
notSuccessful(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform all non-'successful' (1xx, 3xx, 4xx, 5xx) HTTP responses. |
ResponseTransformation<O> |
ok(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'ok' (200) HTTP responses. |
ResponseTransformation<O> |
on(HttpStatus status,
com.google.common.base.Function<Response,? extends O> f)
Register a function to transform HTTP responses with a specific status. |
ResponseTransformation<O> |
on(int statusCode,
com.google.common.base.Function<Response,? extends O> f)
Register a function to transform HTTP responses with a specific status code. |
ResponseTransformation<O> |
others(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform all other HTTP responses (i.e. |
ResponseTransformation<O> |
otherwise(com.google.common.base.Function<java.lang.Throwable,O> 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<O> |
redirection(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'redirection' (3xx) HTTP responses. |
ResponseTransformation<O> |
seeOther(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'see other' (303) HTTP responses. |
ResponseTransformation<O> |
serverError(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'server error' (5xx) HTTP responses. |
ResponseTransformation<O> |
serviceUnavailable(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'service unavailable' (503) HTTP responses. |
ResponseTransformation<O> |
successful(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'successful' (2xx) HTTP responses. |
com.atlassian.util.concurrent.Promise<O> |
toPromise()
Converts the transformation into a promise for further mapping |
ResponseTransformation<O> |
unauthorized(com.google.common.base.Function<Response,? extends O> f)
Register a function to transform 'unauthorized' (401) HTTP responses. |
| Method Detail |
|---|
ResponseTransformation<O> on(HttpStatus status,
com.google.common.base.Function<Response,? extends O> f)
status - The HTTP status to select onf - The transformation function
on(int, com.google.common.base.Function)
ResponseTransformation<O> on(int statusCode,
com.google.common.base.Function<Response,? extends O> 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.
statusCode - The code to select onf - The transformation function
on(HttpStatus, com.google.common.base.Function)ResponseTransformation<O> informational(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> successful(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> ok(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> created(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> noContent(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> redirection(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> seeOther(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> notModified(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> clientError(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> badRequest(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> unauthorized(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> forbidden(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> notFound(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> conflict(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> serverError(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> internalServerError(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> serviceUnavailable(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> error(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> notSuccessful(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> others(com.google.common.base.Function<Response,? extends O> f)
f - The transformation function
ResponseTransformation<O> otherwise(com.google.common.base.Function<java.lang.Throwable,O> f)
fail()
f - The transformation function
ResponseTransformation<O> done(com.google.common.base.Function<Response,O> f)
f - The transformation function
ResponseTransformation<O> fail(com.google.common.base.Function<java.lang.Throwable,? extends O> f)
f - The transformation function
O claim()
com.atlassian.util.concurrent.Promise<O> toPromise()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||