Package com.ning.http.client

Examples of com.ning.http.client.FluentCaseInsensitiveStringsMap


                }
            });
            handler.onHeadersReceived(new HttpResponseHeaders(uri, this) {
                @Override
                public FluentCaseInsensitiveStringsMap getHeaders() {
                    return new FluentCaseInsensitiveStringsMap();
                }
            });
            handler.onBodyPartReceived(new HttpResponseBodyPart(uri, this) {
                @Override
                public byte[] getBodyPartBytes() {
View Full Code Here


        return cr;
    }

    private void processResponseHeaders(final ClientResponse cr, final Response response) {
        FluentCaseInsensitiveStringsMap headers = response.getHeaders();
        for (Map.Entry<String, List<String>> header : headers) {
            for (String value : header.getValue()) {
                cr.getHeaders().add(header.getKey(), value);
            }
        }
View Full Code Here

    @Override
    public com.ning.http.client.AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders h)
        throws Exception
    {
        FluentCaseInsensitiveStringsMap headers = (h == null) ? null : h.getHeaders();
        _headers = headers;
        String comps = (headers == null) ? null : headers.getFirstValue(ClusterMateConstants.HTTP_HEADER_COMPRESSION);
        if (comps != null && !comps.isEmpty()) {
            Uncompressor uncomp = null;
            Compression c = Compression.from(comps);
            if (c == Compression.LZF) {
                uncomp = new LZFUncompressor(this);
View Full Code Here

        }
    }

    private InBoundHeaders getInBoundHeaders(final Response response) throws ExecutionException, InterruptedException {
        final InBoundHeaders headers = new InBoundHeaders();
        FluentCaseInsensitiveStringsMap responseHeaders = response.getHeaders();

        for (FluentCaseInsensitiveStringsMap.Entry<String, List<String>> header : responseHeaders) {
            headers.put(header.getKey(), header.getValue());
        }
View Full Code Here

        processResponseHeaders(cr, response);
        return cr;
    }

    private void processResponseHeaders(final ClientResponse cr, final Response response) {
        FluentCaseInsensitiveStringsMap headers = response.getHeaders();
        for (Map.Entry<String, List<String>> header : headers) {
            for (String value : header.getValue()) {
                cr.getHeaders().add(header.getKey(), value);
            }
        }
View Full Code Here

        this.method = method;
        headers = computerHeaders();
    }

    private FluentCaseInsensitiveStringsMap computerHeaders() {
        FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap();

        Header[] uh = method.getResponseHeaders();

        for (Header e : uh) {
            if (e.getName() != null) {
                h.add(e.getName(), e.getValue());
            }
        }

        uh = method.getResponseFooters();
        for (Header e : uh) {
            if (e.getName() != null) {
                h.add(e.getName(), e.getValue());
            }
        }

        return h;
    }
View Full Code Here

        this.urlConnection = urlConnection;
        headers = computerHeaders();
    }

    private FluentCaseInsensitiveStringsMap computerHeaders() {
        FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap();

        Map<String, List<String>> uh = urlConnection.getHeaderFields();

        for (Map.Entry<String, List<String>> e : uh.entrySet()) {
            if (e.getKey() != null) {
                h.add(e.getKey(), e.getValue());
            }
        }
        return h;
    }
View Full Code Here

            if (config.isCompressionEnabled()) {
                urlConnection.setRequestProperty("Accept-Encoding", "gzip");
            }

            if (!method.equalsIgnoreCase("CONNECT")) {
                FluentCaseInsensitiveStringsMap h = request.getHeaders();
                if (h != null) {
                    for (String name : h.keySet()) {
                        if (!"host".equalsIgnoreCase(name)) {
                            for (String value : h.get(name)) {
                                urlConnection.setRequestProperty(name, value);
                                if (name.equalsIgnoreCase("Expect")) {
                                    throw new IllegalStateException("Expect: 100-Continue not supported");
                                }
                            }
View Full Code Here

                }
            }

            if (TransferCompletionHandler.class.isAssignableFrom(future.getAsyncHandler().getClass())) {

                FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap();
                for (String s : future.getNettyRequest().getHeaderNames()) {
                    for (String header : future.getNettyRequest().getHeaders(s)) {
                        h.add(s, header);
                    }
                }

                TransferCompletionHandler.class.cast(future.getAsyncHandler()).transferAdapter(
                        new NettyTransferAdapter(h, nettyRequest.getContent(), future.getRequest().getFile()));
View Full Code Here

        } else {
            host = "127.0.0.1";
        }

        if (!m.equals(HttpMethod.CONNECT)) {
            FluentCaseInsensitiveStringsMap h = request.getHeaders();
            if (h != null) {
                for (String name : h.keySet()) {
                    if (!"host".equalsIgnoreCase(name)) {
                        for (String value : h.get(name)) {
                            nettyRequest.addHeader(name, value);
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.ning.http.client.FluentCaseInsensitiveStringsMap

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.