use of com.twitter.finagle.http.Response in project bookkeeper by apache.
the class TwitterAbstractHandler method processRequest.
/**
* Process the request using the given httpEndpointService.
*/
Future<Response> processRequest(HttpEndpointService httpEndpointService, Request request) {
HttpServiceRequest httpServiceRequest = new HttpServiceRequest().setMethod(convertMethod(request)).setParams(convertParams(request)).setBody(request.contentString());
HttpServiceResponse httpServiceResponse = null;
try {
httpServiceResponse = httpEndpointService.handle(httpServiceRequest);
} catch (Exception e) {
httpServiceResponse = new ErrorHttpService().handle(httpServiceRequest);
}
Response response = Response.apply();
response.setContentString(httpServiceResponse.getBody());
response.statusCode(httpServiceResponse.getStatusCode());
return Future.value(response);
}
Aggregations