/** * 요청 객체에서 라벨ID 를 set 형태로 추출한다. * * @param request 요청 * @return 라벨ID set */ public static Set<Long> getLabelIds(final Request request) { Set<Long> set = new HashSet<>(); String[] labelIds = request.queryString().get("labelIds"); if (labelIds != null) { for (String labelId : labelIds) { set.add(Long.valueOf(labelId)); } } return set; }
/** * Check the identity of the user from the current request, that should be the callback from the * OpenID server */ public static F.Promise<UserInfo> verifiedId() { Request request = Http.Context.current().request(); scala.concurrent.Future<UserInfo> scalaPromise = play.api.libs.openid.OpenID.verifiedId(request.queryString()) .map( new AbstractFunction1<play.api.libs.openid.UserInfo, UserInfo>() { @Override public UserInfo apply(play.api.libs.openid.UserInfo scalaUserInfo) { return new UserInfo( scalaUserInfo.id(), JavaConversions.mapAsJavaMap(scalaUserInfo.attributes())); } }, Invoker.executionContext()); return F.Promise.wrap(scalaPromise); }
@Override public Map<String, String[]> getRequestParameters() { final Http.RequestBody body = request.body(); final Map<String, String[]> formParameters; if (body != null) { formParameters = body.asFormUrlEncoded(); } else { formParameters = new HashMap<>(); } final Map<String, String[]> urlParameters = request.queryString(); final Map<String, String[]> parameters = new HashMap<>(); if (formParameters != null) { parameters.putAll(formParameters); } if (urlParameters != null) { parameters.putAll(urlParameters); } return parameters; }