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


Java Request.getQueryString方法代码示例

本文整理汇总了Java中play.mvc.Http.Request.getQueryString方法的典型用法代码示例。如果您正苦于以下问题:Java Request.getQueryString方法的具体用法?Java Request.getQueryString怎么用?Java Request.getQueryString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在play.mvc.Http.Request的用法示例。


在下文中一共展示了Request.getQueryString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAction

import play.mvc.Http.Request; //导入方法依赖的package包/类
@Override
public Action<Void> createAction(Request request, Method actionMethod) {

    return new Action.Simple() {
        @Override
        public Promise<Result> call(Context ctx) throws Throwable {
            // Inject the required services into the context
            injectCommonServicesIncontext(ctx);
            final Language language = new Language(request.getQueryString("lang"));

            if (messagesPlugin.isLanguageValid(language.getCode())) {
                Logger.debug("change language to: " + language.getCode());
                ctx.changeLang(language.getCode());
                // Update the CAS language cookie which is relying on Spring
                // framework (not really solid yet works)
                Utilities.setSsoLanguage(ctx, language.getCode());
            }

            return delegate.call(ctx);

        }
    };

}
 
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:25,代码来源:MafHttpRequestHandler.java

示例2: apply

import play.mvc.Http.Request; //导入方法依赖的package包/类
@Override
public Promise<Result> apply(Request request, Method method, Context context, Action<?> action)
    throws Throwable {
  String token = getAuthorizationToken(request);
  if (token == null) {
    token = request.getQueryString(OAuth2AccessToken.ACCESS_TOKEN);
  }
  if (token == null) {
    logger.info("Authentication skipped");
  } else {
    Authentication authRequest = new PreAuthenticatedAuthenticationToken(token, "");
    Authentication authResult = oauth2AuthenticationManager.authenticate(authRequest);
    SecurityContextHolder.getContext().setAuthentication(authResult);
    logger.info("Authenticated successfully");
  }
  return action.call(context);
}
 
开发者ID:tfeng,项目名称:play-oauth2,代码行数:18,代码来源:SecurityAuthenticationFilter.java

示例3: getAuthorizationToken

import play.mvc.Http.Request; //导入方法依赖的package包/类
private static String getAuthorizationToken(Request request) {
  String[] headers = request.headers().get(AUTHORIZATION);
  if (headers != null) {
    for (String header : headers) {
      if (header.toLowerCase().startsWith(BEARER.toLowerCase())) {
        String authHeaderValue = header.substring(BEARER.length()).trim();
        return authHeaderValue.split(",")[0];
      }
    }
  }
  return request.getQueryString(ACCESS_TOKEN);
}
 
开发者ID:tfeng,项目名称:play-plugins,代码行数:13,代码来源:OAuth2AuthenticationAction.java


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