本文整理了Java中org.apache.cxf.jaxrs.client.WebClient.replaceHeader()
方法的一些代码示例,展示了WebClient.replaceHeader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.replaceHeader()
方法的具体详情如下:
包路径:org.apache.cxf.jaxrs.client.WebClient
类名称:WebClient
方法名:replaceHeader
[英]Replaces the header value with the new values.
[中]用新值替换标题值。
代码示例来源:origin: apache/cxf
public static void setAuthorizationHeader(WebClient wc,
ClientAccessToken accessToken,
String httpVerb) {
wc.replaceHeader(HttpHeaders.AUTHORIZATION,
createAuthorizationHeader(accessToken,
new HttpRequestProperties(wc, httpVerb)));
}
代码示例来源:origin: org.apache.cxf/cxf-rt-rs-security-oauth2
public static void setAuthorizationHeader(WebClient wc,
ClientAccessToken accessToken,
String httpVerb) {
wc.replaceHeader(HttpHeaders.AUTHORIZATION,
createAuthorizationHeader(accessToken,
new HttpRequestProperties(wc, httpVerb)));
}
代码示例来源:origin: apache/cxf
private static Token getToken(WebClient tokenService, OAuthAccessor accessor,
Map<String, String> parameters) throws OAuthServiceException {
String header = doGetAuthorizationHeader(accessor,
"POST",
tokenService.getBaseURI().toString(),
parameters);
try {
tokenService.replaceHeader("Authorization", header);
Form form = tokenService.post(null, Form.class);
return new Token(form.asMap().getFirst("oauth_token"),
form.asMap().getFirst("oauth_token_secret"));
} catch (WebApplicationException ex) {
throw new OAuthServiceException(ex);
}
}
代码示例来源:origin: apache/cxf
throw new ProcessingException(ex);
accessTokenService.replaceHeader("Authorization", sb.toString());
} else {
form.param(OAuthConstants.CLIENT_ID, consumer.getClientId());
代码示例来源:origin: Talend/tesb-rt-se
String authHeader = manager.createAuthorizationHeader(accessToken, "GET",
socialService.getCurrentURI().toString());
socialService.replaceHeader("Authorization", authHeader);
socialService.replaceHeader("Authorization", authHeader);
代码示例来源:origin: Talend/tesb-rt-se
try {
String authHeader = manager.createAuthorizationHeader(accessToken);
socialService.replaceHeader("Authorization", authHeader);
socialService.replaceHeader("Authorization", authHeader);
代码示例来源:origin: org.apache.cxf/cxf-rt-rs-security-oauth2
throw new ProcessingException(ex);
accessTokenService.replaceHeader("Authorization", sb.toString());
} else {
form.param(OAuthConstants.CLIENT_ID, consumer.getClientId());
代码示例来源:origin: apache/cxf
@Test
public void testGetGenericBook() throws Exception {
String baseAddress = "http://localhost:" + PORT + "/the/thebooks8/books";
WebClient wc = WebClient.create(baseAddress);
Long id = wc.type("application/xml").accept("text/plain").post(new Book("CXF", 1L), Long.class);
assertEquals(Long.valueOf(1), id);
Book book = wc.replaceHeader("Accept", "application/xml").query("id", 1L).get(Book.class);
assertEquals("CXF", book.getName());
}
代码示例来源:origin: apache/cxf
userInfoClient.replaceHeader("Authorization", "Bearer " + newAccessToken);
serviceResponse = userInfoClient.get();
assertEquals(serviceResponse.getStatus(), 200);
内容来源于网络,如有侵权,请联系作者删除!