本文整理汇总了Java中org.springframework.web.util.UriComponentsBuilder.fromHttpUrl方法的典型用法代码示例。如果您正苦于以下问题:Java UriComponentsBuilder.fromHttpUrl方法的具体用法?Java UriComponentsBuilder.fromHttpUrl怎么用?Java UriComponentsBuilder.fromHttpUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.util.UriComponentsBuilder
的用法示例。
在下文中一共展示了UriComponentsBuilder.fromHttpUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInternalExecute
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
@Override
protected Event doInternalExecute(final HttpServletRequest request, final HttpServletResponse response,
final RequestContext context) throws Exception {
final List<LogoutRequest> logoutRequests = WebUtils.getLogoutRequests(context);
final Integer startIndex = getLogoutIndex(context);
if (logoutRequests != null) {
for (int i = startIndex; i < logoutRequests.size(); i++) {
final LogoutRequest logoutRequest = logoutRequests.get(i);
if (logoutRequest.getStatus() == LogoutRequestStatus.NOT_ATTEMPTED) {
// assume it has been successful
logoutRequest.setStatus(LogoutRequestStatus.SUCCESS);
// save updated index
putLogoutIndex(context, i + 1);
final String logoutUrl = logoutRequest.getLogoutUrl().toExternalForm();
LOGGER.debug("Using logout url [{}] for front-channel logout requests", logoutUrl);
final String logoutMessage = logoutManager.createFrontChannelLogoutMessage(logoutRequest);
LOGGER.debug("Front-channel logout message to send under [{}] is [{}]",
this.logoutRequestParameter, logoutMessage);
// redirect to application with SAML logout message
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(logoutUrl);
builder.queryParam(this.logoutRequestParameter, URLEncoder.encode(logoutMessage, "UTF-8"));
return result(REDIRECT_APP_EVENT, DEFAULT_FLOW_ATTRIBUTE_LOGOUT_URL, builder.build().toUriString());
}
}
}
// no new service with front-channel logout -> finish logout
return new Event(this, FINISH_EVENT);
}
示例2: doInternalExecute
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
@Override
protected Event doInternalExecute(final HttpServletRequest request, final HttpServletResponse response,
final RequestContext context) throws Exception {
final List<LogoutRequest> logoutRequests = WebUtils.getLogoutRequests(context);
final Integer startIndex = getLogoutIndex(context);
if (logoutRequests != null && startIndex != null) {
for (int i = startIndex; i < logoutRequests.size(); i++) {
final LogoutRequest logoutRequest = logoutRequests.get(i);
if (logoutRequest.getStatus() == LogoutRequestStatus.NOT_ATTEMPTED) {
// assume it has been successful
logoutRequest.setStatus(LogoutRequestStatus.SUCCESS);
// save updated index
putLogoutIndex(context, i + 1);
// redirect to application with SAML logout message
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(logoutRequest.getService().getId());
builder.queryParam("SAMLRequest",
URLEncoder.encode(logoutManager.createFrontChannelLogoutMessage(logoutRequest), "UTF-8"));
return result(REDIRECT_APP_EVENT, "logoutUrl", builder.build().toUriString());
}
}
}
// no new service with front-channel logout -> finish logout
return new Event(this, FINISH_EVENT);
}
示例3: getMap
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked"})
private Map<String, Object> getMap(String path, String accessToken) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Getting user info from: " + path);
}
try {
String openIdUri = "https://api.weibo.com/2/account/get_uid.json";
UriComponentsBuilder builder = UriComponentsBuilder
.fromHttpUrl(openIdUri);
builder.queryParam("access_token", accessToken);
Map uidMap = restTemplate.getForObject(builder.build().encode().toUri(), Map.class);
/**
*callback( {"client_id":"101446208","openid":"A193D12113B979C63F73211447C84A91"} );
*/
Object uid = uidMap.get("uid");
log.info("{},openId:{}", uidMap, uid);
builder = UriComponentsBuilder
.fromHttpUrl(path);
builder.queryParam("uid", uid);
builder.queryParam("access_token", accessToken);
URI userInfoUrl = builder.build().encode().toUri();
log.info("userInfoUrl:{}", userInfoUrl.toString());
Map result = restTemplate.getForEntity(userInfoUrl, Map.class).getBody();
log.info("userInfo:{}", result);
return result;
} catch (Exception ex) {
this.logger.warn("Could not fetch user details: " + ex.getClass() + ", "
+ ex.getMessage());
return Collections.<String, Object>singletonMap("error",
"Could not fetch user details");
}
}
示例4: extractURI
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
private URI extractURI(HttpRequestBuilder httpRequest) {
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(httpRequest.getUrl());
if (httpRequest.getPaths() != null) {
for (String path : httpRequest.getPaths()) {
builder.path(path).path("/");
}
}
return builder.build().toUri();
}
示例5: GetFilteredApprovalsCommand
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
public GetFilteredApprovalsCommand(RestTemplate restTemplate, String url,
ApprovalFilters approvalFilters) {
super(HystrixCommandGroupKey.Factory.asKey(Constants.APPROVALS_CLIENT),
Constants.TIMEOUT_IN_MILLISECONDS);
this.restTemplate = restTemplate;
this.uriBuilder = UriComponentsBuilder.fromHttpUrl(url);
this.approvalFilters = approvalFilters;
}
示例6: rootUrl
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
public UriComponentsBuilder rootUrl() {
return UriComponentsBuilder.fromHttpUrl(url);
}
示例7: main
import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
public static void main(String[] args) throws JsonProcessingException {
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://api.wx.com");
MvcUriComponentsBuilder.fromMethod(builder, WxBuildinVerifyService.class, ClassUtils.getMethod(WxBuildinVerifyService.class, "verify", null), "a", "a", "a", "a");
System.out.println(builder);
}