Search in sources :

Example 1 with BodyGenerator

use of com.facebook.airlift.http.client.BodyGenerator in project presto by prestodb.

the class ResourceManagerProxy method performRequest.

public void performRequest(HttpServletRequest servletRequest, AsyncResponse asyncResponse, URI remoteUri) {
    try {
        BodyGenerator bodyGenerator = new InputStreamBodyGenerator(servletRequest.getInputStream());
        Request request = createRequest(servletRequest, servletRequest.getMethod(), remoteUri, bodyGenerator);
        ListenableFuture<ProxyResponse> proxyResponse = httpClient.executeAsync(request, new ResponseHandler());
        ListenableFuture<Response> future = transform(proxyResponse, this::toResponse, executor);
        setupAsyncResponse(servletRequest, asyncResponse, future);
    } catch (IOException e) {
        asyncResponse.resume(e);
    }
}
Also used : AsyncResponseHandler.bindAsyncResponse(com.facebook.airlift.http.server.AsyncResponseHandler.bindAsyncResponse) AsyncResponse(javax.ws.rs.container.AsyncResponse) Response(javax.ws.rs.core.Response) BodyGenerator(com.facebook.airlift.http.client.BodyGenerator) HttpServletRequest(javax.servlet.http.HttpServletRequest) Request(com.facebook.airlift.http.client.Request) IOException(java.io.IOException)

Aggregations

BodyGenerator (com.facebook.airlift.http.client.BodyGenerator)1 Request (com.facebook.airlift.http.client.Request)1 AsyncResponseHandler.bindAsyncResponse (com.facebook.airlift.http.server.AsyncResponseHandler.bindAsyncResponse)1 IOException (java.io.IOException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 AsyncResponse (javax.ws.rs.container.AsyncResponse)1 Response (javax.ws.rs.core.Response)1