T
- @FunctionalInterface public interface ListenableFutureHandler<T>
Response
when you want to do things like modify response headers
based on results of service invocations or if you want to set the status code. Example:
public ListenableFuture> invoke(RequestContext requestContest) {
return Futures.transform(futureToStringPayload(),
(String s) -> {
return Response.forPayload(s)
.withHeader("X-Payload-Length", s.length());
});
}
Any other return type will be serialized with the configured serializer and added as payload to
a response with status Status.OK
.Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<T> |
invoke(RequestContext requestContext) |
com.google.common.util.concurrent.ListenableFuture<T> invoke(RequestContext requestContext)
Copyright © 2016. All rights reserved.