本文整理匯總了Java中com.google.appengine.api.users.User.getNickname方法的典型用法代碼示例。如果您正苦於以下問題:Java User.getNickname方法的具體用法?Java User.getNickname怎麽用?Java User.getNickname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.appengine.api.users.User
的用法示例。
在下文中一共展示了User.getNickname方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doPost
import com.google.appengine.api.users.User; //導入方法依賴的package包/類
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
User user = userService.getCurrentUser();
// String rpId = (request.isSecure() ? "https://" : "http://") + request.getHeader("Host");
String rpId = request.getHeader("Host").split(":")[0];
String rpName = getServletContext().getInitParameter("name");
rpName = (rpName == null ? "" : rpName);
MakePublicKeyCredentialOptions options =
new MakePublicKeyCredentialOptions(user.getNickname(), user.getUserId(), rpId, rpName);
String hasAdvanced = request.getParameter("advanced");
if (hasAdvanced.equals("true")) {
parseAdvancedOptions(request.getParameter("advancedOptions"), options);
}
SessionData session = new SessionData(options.challenge, rpId);
session.save(userService.getCurrentUser().getUserId());
JsonObject sessionJson = session.getJsonObject();
JsonObject optionsJson = options.getJsonObject();
optionsJson.add("session", sessionJson);
response.setContentType("application/json");
response.getWriter().println(optionsJson.toString());
}