当前位置: 首页>>代码示例>>Java>>正文


Java UriComponentsBuilder.fromHttpUrl方法代码示例

本文整理汇总了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);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:36,代码来源:FrontChannelLogoutAction.java

示例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);
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:29,代码来源:FrontChannelLogoutAction.java

示例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");
    }
}
 
开发者ID:helloworldtang,项目名称:sns-todo,代码行数:33,代码来源:SinaUserInfoTokenServices.java

示例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();
}
 
开发者ID:intuit,项目名称:karate,代码行数:10,代码来源:KarateRequestConverter.java

示例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;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:9,代码来源:GetFilteredApprovalsCommand.java

示例6: rootUrl

import org.springframework.web.util.UriComponentsBuilder; //导入方法依赖的package包/类
public UriComponentsBuilder rootUrl() {
	return UriComponentsBuilder.fromHttpUrl(url);
}
 
开发者ID:yushijinhun,项目名称:akir,代码行数:4,代码来源:AkirConfiguration.java

示例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);
}
 
开发者ID:FastBootWeixin,项目名称:FastBootWeixin,代码行数:6,代码来源:MethodToUrlTest.java


注:本文中的org.springframework.web.util.UriComponentsBuilder.fromHttpUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。