org.springframework.web.client.RestTemplate.createRequest()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.springframework.web.client.RestTemplate.createRequest方法的一些代码示例,展示了RestTemplate.createRequest的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestTemplate.createRequest方法的具体详情如下:
包路径:org.springframework.web.client.RestTemplate
类名称:RestTemplate
方法名:createRequest

RestTemplate.createRequest介绍

暂无

代码示例

代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization",
        String.format("Basic %s", Base64.encode(String.format("%s:%s", clientId, clientSecret)) ));
    return httpRequest;
  }
};

代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization", String.format("Bearer %s", token.getAccessTokenValue()));
    return httpRequest;
  }
};

代码示例来源:origin: spring-projects/spring-framework

ClientHttpResponse response = null;
try {
  ClientHttpRequest request = createRequest(url, method);
  if (requestCallback != null) {
    requestCallback.doWithRequest(request);

代码示例来源:origin: org.springframework/spring-web

ClientHttpResponse response = null;
try {
  ClientHttpRequest request = createRequest(url, method);
  if (requestCallback != null) {
    requestCallback.doWithRequest(request);

代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization",
        String.format("Basic %s", Base64.encode(String.format("%s:%s",
            UriUtils.encodePathSegment(clientConfig.getClientId(), "UTF-8"),
            UriUtils.encodePathSegment(clientConfig.getClientSecret(), "UTF-8")))));
    return httpRequest;
  }
};

代码示例来源:origin: spring-projects/spring-security-oauth

@Override
protected ClientHttpRequest createRequest(URI uri, HttpMethod method) throws IOException {
  OAuth2AccessToken accessToken = getAccessToken();
  AuthenticationScheme authenticationScheme = resource.getAuthenticationScheme();
  if (AuthenticationScheme.query.equals(authenticationScheme)
      || AuthenticationScheme.form.equals(authenticationScheme)) {
    uri = appendQueryParameter(uri, accessToken);
  }
  ClientHttpRequest req = super.createRequest(uri, method);
  if (AuthenticationScheme.header.equals(authenticationScheme)) {
    authenticator.authenticate(resource, getOAuth2ClientContext(), req);
  }
  return req;
}

代码示例来源:origin: com.dell.cpsd.component/component-common-core

@Override
protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException
{
  ClientHttpRequest request = super.createRequest(url, method);
  populateDefaultHeaders(request);
  return request;
}

代码示例来源:origin: org.mitre/openid-connect-client

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization",
        String.format("Basic %s", Base64.encode(String.format("%s:%s", clientId, clientSecret)) ));
    return httpRequest;
  }
};

代码示例来源:origin: org.mitre/openid-connect-client

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization", String.format("Bearer %s", token.getAccessTokenValue()));
    return httpRequest;
  }
};

代码示例来源:origin: org.mitre/openid-connect-client

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization",
        String.format("Basic %s", Base64.encode(String.format("%s:%s",
            UriUtils.encodePathSegment(clientConfig.getClientId(), "UTF-8"),
            UriUtils.encodePathSegment(clientConfig.getClientSecret(), "UTF-8")))));
    return httpRequest;
  }
};

代码示例来源:origin: com.moomanow/moomanow-oauth2

@Override
  protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
    ClientHttpRequest httpRequest = super.createRequest(url, method);
    httpRequest.getHeaders().add("Authorization",
        String.format("Basic %s", Base64.encode(String.format("%s:%s",
            UriUtils.encodePathSegment(clientConfig.getClientId(), "UTF-8"),
            UriUtils.encodePathSegment(clientConfig.getClientSecret(), "UTF-8")))));
    return httpRequest;
  }
};

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

ClientHttpResponse response = null;
try {
  ClientHttpRequest request = createRequest(url, method);
  if (requestCallback != null) {
    requestCallback.doWithRequest(request);

代码示例来源:origin: apache/servicemix-bundles

ClientHttpResponse response = null;
try {
  ClientHttpRequest request = createRequest(url, method);
  if (requestCallback != null) {
    requestCallback.doWithRequest(request);

代码示例来源:origin: org.springframework.android/spring-android-rest-template

ClientHttpResponse response = null;
try {
  ClientHttpRequest request = createRequest(url, method);
  if (requestCallback != null) {
    requestCallback.doWithRequest(request);

代码示例来源:origin: org.springframework.security.oauth/spring-security-oauth2

@Override
protected ClientHttpRequest createRequest(URI uri, HttpMethod method) throws IOException {
  OAuth2AccessToken accessToken = getAccessToken();
  AuthenticationScheme authenticationScheme = resource.getAuthenticationScheme();
  if (AuthenticationScheme.query.equals(authenticationScheme)
      || AuthenticationScheme.form.equals(authenticationScheme)) {
    uri = appendQueryParameter(uri, accessToken);
  }
  ClientHttpRequest req = super.createRequest(uri, method);
  if (AuthenticationScheme.header.equals(authenticationScheme)) {
    authenticator.authenticate(resource, getOAuth2ClientContext(), req);
  }
  return req;
}

相关文章