Examples of addHeader()


Examples of org.apache.http.client.methods.HttpPut.addHeader()

                .getSchemeRegistry().getScheme("https").getSocketFactory();
        sf.setHostnameVerifier(new AllowAllHostnameVerifier());

        HttpPut request = new HttpPut(Application.baseRestUrl + "/communities/" + this.id);
        request.setHeader("Accept", "application/json");
        request.addHeader("Content-Type", "application/json");
        request.addHeader("rest-dspace-token", token);

        //Only allow certain attributes... "name", "copyrightText", "introductoryText", "shortDescription", "sidebarText"
        Logger.info("EditCommunity json: " + Json.toJson(this).toString());
        ObjectNode jsonObjectNode = Json.newObject().put("name", this.name).put("copyrightText", this.copyrightText)
View Full Code Here

Examples of org.apache.http.client.methods.HttpRequestBase.addHeader()

                // add the value(s) as a http request header
                if (values.size() > 0) {
                    // use the default toString of a ArrayList to create in the form [xxx, yyy]
                    // if multi valued, for a single value, then just output the value as is
                    String s =  values.size() > 1 ? values.toString() : values.get(0);
                    httpRequest.addHeader(key, s);
                }
            }
        }

        // lets store the result in the output message.
View Full Code Here

Examples of org.apache.http.client.methods.HttpRequestWrapper.addHeader()

        impl = createCachingExecChain(mockBackend, new BasicHttpCache(), CacheConfig.DEFAULT);
        final HttpRequestWrapper req1 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(new HttpGet(
            "http://foo.example.com/"));
        req2.addHeader("If-Modified-Since", DateUtils.formatDate(now));
        final HttpResponse resp1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK,
            "OK");
        resp1.setEntity(HttpTestUtils.makeBody(128));
        resp1.setHeader("Content-Length", "128");
        resp1.setHeader("ETag", "\"etag\"");
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest.addHeader()

            //Adding headers
            if (this.contentType == null){
                this.contentType = SynchronousRestClient.xmlContentType;
            }
            httpMethod.addHeader("Content-type", this.contentType);
            if (authorizationValue != null) {
                httpMethod.addHeader("Authorization", ApacheRestClient.authorizationValue);
            }

            //Executing
View Full Code Here

Examples of org.apache.http.client.methods.RequestBuilder.addHeader()

    protected HttpUriRequest getHttpUriRequest(Request request, Site site, Map<String, String> headers) {
        RequestBuilder requestBuilder = selectRequestMethod(request).setUri(request.getUrl());
        if (headers != null) {
            for (Map.Entry<String, String> headerEntry : headers.entrySet()) {
                requestBuilder.addHeader(headerEntry.getKey(), headerEntry.getValue());
            }
        }
        RequestConfig.Builder requestConfigBuilder = RequestConfig.custom()
                .setConnectionRequestTimeout(site.getTimeOut())
                .setSocketTimeout(site.getTimeOut())
View Full Code Here

Examples of org.apache.http.impl.client.RequestWrapper.addHeader()

                    break;
                }
            }
        }
        if (mustRevalidate) {
            wrapperRequest.addHeader("Cache-Control","max-age=0");
        }
        return wrapperRequest;

    }
View Full Code Here

Examples of org.apache.http.message.AbstractHttpMessage.addHeader()

            // Get request headers
            MultiValueMap<String, String> header_data = request.getHeaders();
            for (String key : header_data.keySet()) {
                for(String value: header_data.get(key)) {
                    Header header = new BasicHeader(key, value);
                    method.addHeader(header);
                }
            }

            // POST/PUT method specific logic
            if (method instanceof HttpEntityEnclosingRequest) {
View Full Code Here

Examples of org.apache.http.message.BasicHttpEntityEnclosingRequest.addHeader()

        emptyMockCacheExpectsNoPuts();

        final BasicHttpEntityEnclosingRequest put = new BasicHttpEntityEnclosingRequest("PUT", "/",
                HttpVersion.HTTP_1_1);
        put.setEntity(HttpTestUtils.makeBody(128));
        put.addHeader("Content-Length", "128");

        originResponse.setHeader("Cache-Control", "max-age=3600");

        EasyMock.expect(
                mockBackend.execute(
View Full Code Here

Examples of org.apache.http.message.BasicHttpRequest.addHeader()

    private final static HttpRequest createRequest(HttpHost target) {

        HttpRequest req = new BasicHttpRequest
            ("OPTIONS", "*", HttpVersion.HTTP_1_1);

        req.addHeader("Host", target.getHostName());

        return req;
    }


View Full Code Here

Examples of org.apache.http.message.BasicHttpResponse.addHeader()

        BasicHttpResponse response = new BasicHttpResponse(new ProtocolVersion("HTTP", 1, 1), 400, "Exception: "
                + errorMessage);
        response.setEntity(entity);

        response.addHeader("Content-Disposition", "attachment; filename=error");

        return response;
    }

    private void execute() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.