Package com.ning.http.client

Examples of com.ning.http.client.FluentCaseInsensitiveStringsMap


                    return;
                }

                Realm newRealm = null;
                ProxyServer proxyServer = request.getProxyServer() != null ? request.getProxyServer() : config.getProxyServer();
                final FluentCaseInsensitiveStringsMap headers = request.getHeaders();
                final RequestBuilder builder = new RequestBuilder(future.getRequest());

                if (realm != null && !future.getURI().getPath().equalsIgnoreCase(realm.getUri())) {
                    builder.setUrl(future.getURI().toString());
                }
View Full Code Here


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

    private FluentCaseInsensitiveStringsMap computerHeaders() {
        FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap();
        for (String s : response.getHeaderNames()) {
            for (String header : response.getHeaders(s)) {
                h.add(s, header);
            }
        }

        if (trailingHeaders != null && trailingHeaders.getHeaderNames().size() > 0) {
            for (final String s : trailingHeaders.getHeaderNames()) {
                for (String header : response.getHeaders(s)) {
                    h.add(s, header);
                }
            }
        }

        return h;
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

                throw new RuntimeException(e);
            }
            parts.add(filePart);
        }

        MultipartRequestEntity requestEntity = new MultipartRequestEntity(parts.toArray(new Part[parts.size()]), new FluentCaseInsensitiveStringsMap());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            requestEntity.writeRequest(baos);
        } catch (IOException e) {
            throw new RuntimeException(e);
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

    @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

    @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

    @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

            throw new IllegalStateException("Impossible body: " + body);
        }
    }

    private F.Promise<play.libs.ws.WSResponse> executeString(String body) {
        FluentCaseInsensitiveStringsMap headers = new FluentCaseInsensitiveStringsMap(this.headers);

        // Detect and maybe add charset
        String contentType = headers.getFirstValue(HttpHeaders.Names.CONTENT_TYPE);
        if (contentType == null) {
            contentType = "text/plain";
        }
        String charset = AsyncHttpProviderUtils.parseCharset(contentType);
        if (charset == null) {
            charset = "utf-8";
            headers.replace(HttpHeaders.Names.CONTENT_TYPE, contentType + "; charset=utf-8");
        }

        byte[] bodyBytes;
        try {
            bodyBytes = body.getBytes(charset);
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.