Package org.springframework.web.client

Examples of org.springframework.web.client.RequestCallback


    Map<String, Object> employeeSearchMap = getEmployeeSearchMap("0");

    final String fullUrl = "http://localhost:8080/rest-http/services/employee/{id}/search";

    EmployeeList employeeList = restTemplate.execute(fullUrl, HttpMethod.GET,
        new RequestCallback() {
          @Override
          public void doWithRequest(ClientHttpRequest request) throws IOException {
            HttpHeaders headers = getHttpHeadersWithUserCredentials(request);
            headers.add("Accept", "application/xml");
          }
View Full Code Here


    boolean supportsRanges;
    try {
      supportsRanges = getRestTemplate().execute(getUrl(urlPath),
          HttpMethod.HEAD,
          new RequestCallback() {
            public void doWithRequest(ClientHttpRequest request) throws IOException {
              request.getHeaders().set("Range", "bytes=0-");
            }
          },
          new ResponseExtractor<Boolean>() {
View Full Code Here

    byte[] responseBytes;
    try {
      responseBytes = restOperations.execute(
          dataUrl,
          HttpMethod.GET,
          new RequestCallback() {
            public void doWithRequest(ClientHttpRequest clientHttpRequest) throws IOException {
              clientHttpRequest.getHeaders().set("Auth-Token", auth);
            }
          },
          new ResponseExtractor<byte[]>() {
View Full Code Here

    return postForHeaders(path, formData, null);
  }

  public HttpHeaders postForHeaders(String path, MultiValueMap<String, String> formData, final HttpHeaders headers) {

    RequestCallback requestCallback = new NullRequestCallback();
    if (headers != null) {
      requestCallback = new RequestCallback() {
        public void doWithRequest(ClientHttpRequest request) throws IOException {
          request.getHeaders().putAll(headers);
        }
      };
    }
View Full Code Here

      throw new IllegalStateException("Could not decode URL", e);
    }
  }

  public HttpStatus getStatusCode(String path, final HttpHeaders headers) {
    RequestCallback requestCallback = new NullRequestCallback();
    if (headers != null) {
      requestCallback = new RequestCallback() {
        public void doWithRequest(ClientHttpRequest request) throws IOException {
          request.getHeaders().putAll(headers);
        }
      };
    }
View Full Code Here

  }


  @Override
  public ResponseEntity<String> executeInfoRequestInternal(URI infoUrl) {
    RequestCallback requestCallback = new XhrRequestCallback(getRequestHeaders());
    return this.restTemplate.execute(infoUrl, HttpMethod.GET, requestCallback, textExtractor);
  }
View Full Code Here

    return this.restTemplate.execute(infoUrl, HttpMethod.GET, requestCallback, textExtractor);
  }

  @Override
  public ResponseEntity<String> executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message) {
    RequestCallback requestCallback = new XhrRequestCallback(headers, message.getPayload());
    return this.restTemplate.execute(url, HttpMethod.POST, requestCallback, textExtractor);
  }
View Full Code Here

        }
      }
    }

    private void readStream(RestTemplate restTemplate) {
      restTemplate.execute(buildUri(), HttpMethod.GET, new RequestCallback() {

        @Override
        public void doWithRequest(ClientHttpRequest request) throws IOException {
        }
      },
View Full Code Here

TOP

Related Classes of org.springframework.web.client.RequestCallback

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.