Package com.facebook.presto.jdbc.internal.jetty.client.api

Examples of com.facebook.presto.jdbc.internal.jetty.client.api.Request


        // Mark atomically the request as terminated and failed,
        // with respect to concurrency between request and response.
        Result result = exchange.terminateRequest(failure);

        Request request = exchange.getRequest();
        LOG.debug("Request failure {} {}", exchange, failure);
        HttpDestination destination = getHttpChannel().getHttpDestination();
        destination.getRequestNotifier().notifyFailure(request, failure);

        boolean notCommitted = isBeforeCommit(requestState);
        if (result == null && notCommitted && request.getAbortCause() == null)
        {
            // Complete the response from here
            if (exchange.responseComplete())
            {
                result = exchange.terminateResponse(failure);
View Full Code Here


        {
            HttpExchange exchange = getHttpExchange();
            if (exchange == null)
                return;

            Request request = exchange.getRequest();
            if (!headersToCommit(request))
                return;

            HttpContent content = HttpSender.this.content;
View Full Code Here

        {
            HttpExchange exchange = getHttpExchange();
            if (exchange == null)
                return Action.IDLE;

            Request request = exchange.getRequest();
            HttpContent content = HttpSender.this.content;

            ByteBuffer contentBuffer = content.getContent();
            if (contentBuffer != null)
            {
View Full Code Here

        return newHttpRequest(newConversation(), uri);
    }

    protected Request copyRequest(HttpRequest oldRequest, URI newURI)
    {
        Request newRequest = newHttpRequest(oldRequest.getConversation(), newURI);
        newRequest.method(oldRequest.getMethod())
                .version(oldRequest.getVersion())
                .content(oldRequest.getContent())
                .idleTimeout(oldRequest.getIdleTimeout(), TimeUnit.MILLISECONDS)
                .timeout(oldRequest.getTimeout(), TimeUnit.MILLISECONDS)
                .followRedirects(oldRequest.isFollowRedirects());
        for (HttpField header : oldRequest.getHeaders())
        {
            // We have a new URI, so skip the host header if present
            if (HttpHeader.HOST == header.getHeader())
                continue;

            // Remove expectation headers
            if (HttpHeader.EXPECT == header.getHeader())
                continue;

            // Remove cookies
            if (HttpHeader.COOKIE == header.getHeader())
                continue;

            // Remove authorization headers
            if (HttpHeader.AUTHORIZATION == header.getHeader() ||
                    HttpHeader.PROXY_AUTHORIZATION == header.getHeader())
                continue;

            newRequest.header(header.getName(), header.getValue());
        }
        return newRequest;
    }
View Full Code Here

            private void tunnel(HttpDestination destination, final Connection connection)
            {
                String target = destination.getOrigin().getAddress().asString();
                Origin.Address proxyAddress = destination.getConnectAddress();
                HttpClient httpClient = destination.getHttpClient();
                Request connect = httpClient.newRequest(proxyAddress.getHost(), proxyAddress.getPort())
                        .scheme(HttpScheme.HTTP.asString())
                        .method(HttpMethod.CONNECT)
                        .path(target)
                        .header(HttpHeader.HOST, target)
                        .timeout(httpClient.getConnectTimeout(), TimeUnit.MILLISECONDS);
View Full Code Here

        if (LOG.isDebugEnabled())
            LOG.debug("Processing {} on {}", exchange, connection);
        if (exchange == null)
            return false;

        final Request request = exchange.getRequest();
        Throwable cause = request.getAbortCause();
        if (cause != null)
        {
            if (LOG.isDebugEnabled())
                LOG.debug("Aborted before processing {}: {}", exchange, cause);
            // It may happen that the request is aborted before the exchange
View Full Code Here

            private void tunnel(HttpDestination destination, final Connection connection)
            {
                String target = destination.getOrigin().getAddress().asString();
                Origin.Address proxyAddress = destination.getConnectAddress();
                HttpClient httpClient = destination.getHttpClient();
                Request connect = httpClient.newRequest(proxyAddress.getHost(), proxyAddress.getPort())
                        .scheme(HttpScheme.HTTP.asString())
                        .method(HttpMethod.CONNECT)
                        .path(target)
                        .header(HttpHeader.HOST, target)
                        .timeout(httpClient.getConnectTimeout(), TimeUnit.MILLISECONDS);
View Full Code Here

                connection.close();
            }
        }
        else
        {
            final Request request = exchange.getRequest();
            Throwable cause = request.getAbortCause();
            if (cause != null)
            {
                if (LOG.isDebugEnabled())
                    LOG.debug("Aborted before processing {}: {}", exchange, cause);
                // It may happen that the request is aborted before the exchange
View Full Code Here

        }
    }

    public void send(HttpExchange exchange)
    {
        Request request = exchange.getRequest();
        Throwable cause = request.getAbortCause();
        if (cause != null)
        {
            exchange.abort(cause);
        }
        else
        {
            if (!queuedToBegin(request))
                throw new IllegalStateException();

            ContentProvider contentProvider = request.getContent();
            HttpContent content = this.content = new HttpContent(contentProvider);

            SenderState newSenderState = SenderState.SENDING;
            if (expects100Continue(request))
                newSenderState = content.hasContent() ? SenderState.EXPECTING_WITH_CONTENT : SenderState.EXPECTING;
View Full Code Here

                // Mark atomically the request as terminated and succeeded,
                // with respect to concurrency between request and response.
                Result result = exchange.terminateRequest(null);

                Request request = exchange.getRequest();
                if (LOG.isDebugEnabled())
                    LOG.debug("Request success {}", request);
                HttpDestination destination = getHttpChannel().getHttpDestination();
                destination.getRequestNotifier().notifySuccess(exchange.getRequest());
View Full Code Here

TOP

Related Classes of com.facebook.presto.jdbc.internal.jetty.client.api.Request

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.