Package org.springframework.http.client

Examples of org.springframework.http.client.SimpleClientHttpRequestFactory


  public void buildAuthorizationHeaderValue_oauthEncodedSecrets() throws Exception {
    SigningSupport signingUtils = new SigningSupport();
    signingUtils.setTimestampGenerator(new MockTimestampGenerator(123456789, 987654321));
    URI uri = URIBuilder.fromUri("http://example.com/request").queryParam("b5", "=%3D").queryParam("a3", "a").queryParam("c@", "")
      .queryParam("a2", "r b").build();
    HttpRequest request = new SimpleClientHttpRequestFactory().createRequest(uri, HttpMethod.POST);
    request.getHeaders().setContentType(MediaType.APPLICATION_FORM_URLENCODED);
    String authorizationHeader = signingUtils.buildAuthorizationHeaderValue(request, "c2&a3=2+q".getBytes(), new OAuth1Credentials("9djdj82h48djs9d2", "con+sumer=secret", "kkk9d7dh3k39sjv7", "token+secret="));
    assertAuthorizationHeader(authorizationHeader, "7VuTmiewi5yudNuXhlZvT1UI53w%3D");
  }
View Full Code Here


    restTemplate.getMessageConverters().add( new StringToObjectHttpMessageConverter() );

    // Because we are using LoggingResponseErrorHandler and the data will be extracted from error response
    // We will need to set OutputStreaming false
    // @see http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/client/SimpleClientHttpRequestFactory.html#setOutputStreaming-boolean-
    SimpleClientHttpRequestFactory factory = (SimpleClientHttpRequestFactory) restTemplate.getRequestFactory();
    factory.setOutputStreaming( false );

    restTemplate.setErrorHandler( new LoggingResponseErrorHandler() );

    responseEntity = null;
    statusCodeException = null;
View Full Code Here

TOP

Related Classes of org.springframework.http.client.SimpleClientHttpRequestFactory

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.