Package org.springframework.http

Examples of org.springframework.http.HttpRequest


    this.accessToken = accessToken;
    this.oauth2Version = oauth2Version;
  }
 
  public ClientHttpResponse intercept(final HttpRequest request, final byte[] body, ClientHttpRequestExecution execution) throws IOException {
    HttpRequest protectedResourceRequest = new HttpRequestDecorator(request);
    protectedResourceRequest.getHeaders().set("Authorization", oauth2Version.getAuthorizationHeaderValue(accessToken));
    return execution.execute(protectedResourceRequest, body);
  }
View Full Code Here


    this.oauth1Credentials = oauth1Credentials;
    this.signingUtils = new SigningSupport();
  }

  public ClientHttpResponse intercept(final HttpRequest request, final byte[] body, ClientHttpRequestExecution execution) throws IOException {
    HttpRequest protectedResourceRequest = new HttpRequestDecorator(request);
    protectedResourceRequest.getHeaders().add("Authorization", getAuthorizationHeaderValue(request, body));
    return execution.execute(protectedResourceRequest, body);
  }
View Full Code Here

  public void buildAuthorizationHeaderValue_Request() 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", "consumer_secret", "kkk9d7dh3k39sjv7", "token_secret"));
    assertAuthorizationHeader(authorizationHeader, "qz6HT3AG1Z9J%2BP99O4HeMtClGeY%3D");
  }
View Full Code Here

  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

TOP

Related Classes of org.springframework.http.HttpRequest

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.