本文整理汇总了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);
}
};
}
示例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);
}
示例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);
}