Package org.apache.http.client.methods

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


    String resourceUrl = url + "/bookmark/" + id;

    request = new HttpPut(resourceUrl);
    ((HttpPut) request).setEntity(createEntity(bookmark));
    request.addHeader("Content-Type", "application/json");
    request.addHeader("Authorization", BASIC_CREDENTIALS);
    response = client.execute(request);
    response.close();
    assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode());

    request = new HttpGet(resourceUrl);
View Full Code Here


    StringEntity entity = new StringEntity(contents, ContentType.create(Constants.CT_FHIR_XML, "UTF-8"));

    HttpRequestBase http = createRequest(url, entity);
    if (myHeaders != null) {
      for (Header next : myHeaders) {
        http.addHeader(next);
      }
    }
    return http;
  }
View Full Code Here

            httpMethod == ODataHttpMethod.DELETE ? new HttpDelete() :
                httpMethod == ODataHttpMethod.POST ? new HttpPost() :
                    httpMethod == ODataHttpMethod.PUT ? new HttpPut() : new HttpPatch();
    request.setURI(URI.create(getEndpoint() + uri));
    if (additionalHeader != null) {
      request.addHeader(additionalHeader, additionalHeaderValue);
    }
    if (requestBody != null) {
      ((HttpEntityEnclosingRequest) request).setEntity(new StringEntity(requestBody));
      request.setHeader(HttpHeaders.CONTENT_TYPE, requestContentType);
    }
View Full Code Here

                // 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

    Long id = parseEntity(response.getEntity(), Long.class);
    String resourceUrl = url + "/bookmark/" + id;

    request = new HttpPut(resourceUrl);
    ((HttpPut) request).setEntity(createEntity(bookmark));
    request.addHeader("Content-Type", "application/json");
    request.addHeader("Authorization", BASIC_CREDENTIALS);
    response = client.execute(request);
    response.close();
    assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode());
View Full Code Here

    String resourceUrl = url + "/bookmark/" + id;

    request = new HttpPut(resourceUrl);
    ((HttpPut) request).setEntity(createEntity(bookmark));
    request.addHeader("Content-Type", "application/json");
    request.addHeader("Authorization", BASIC_CREDENTIALS);
    response = client.execute(request);
    response.close();
    assertEquals(SC_NO_CONTENT, response.getStatusLine().getStatusCode());

    request = new HttpGet(resourceUrl);
View Full Code Here

                // 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

                continue;
           
            for (Enumeration enumHeaderValues = request.getHeaders(headerName); enumHeaderValues.hasMoreElements(); )
            {
                String headerValue = (String) enumHeaderValues.nextElement();
                httpRequest.addHeader(headerName, headerValue);
            }
        }
       
        Map<String, String> defaultRequestHeaders = proxyPathMapper.getDefaultRequestHeaders();
       
View Full Code Here

            httpRequest = new HttpDelete(url);
        } else {
            httpRequest = new HttpGet(url);
        }
        for (Map.Entry<String, String> header : request.headers) {
            httpRequest.addHeader(header.getKey(), header.getValue());
        }
        HttpParams params = httpRequest.getParams();
        for (Map.Entry<String, Object> p : parameters.entrySet()) {
            String name = p.getKey();
            String value = p.getValue().toString();
View Full Code Here

            httpMethod == ODataHttpMethod.DELETE ? new HttpDelete() :
                httpMethod == ODataHttpMethod.POST ? new HttpPost() :
                    httpMethod == ODataHttpMethod.PUT ? new HttpPut() : new HttpPatch();
    request.setURI(URI.create(getEndpoint() + uri));
    if (additionalHeader != null) {
      request.addHeader(additionalHeader, additionalHeaderValue);
    }
    if (requestBody != null) {
      ((HttpEntityEnclosingRequest) request).setEntity(new StringEntity(requestBody));
      request.setHeader(HttpHeaders.CONTENT_TYPE, requestContentType);
    }
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.