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


Java User.getAuthDomain方法代码示例

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


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

示例1: createDocument

import com.google.appengine.api.users.User; //导入方法依赖的package包/类
/**
 * Code snippet for creating a Document.
 * @return Document Created document.
 */
public Document createDocument() {
  // [START create_document]
  User currentUser = UserServiceFactory.getUserService().getCurrentUser();
  String userEmail = currentUser == null ? "" : currentUser.getEmail();
  String userDomain = currentUser == null ? "" : currentUser.getAuthDomain();
  String myDocId = "PA6-5000";
  Document doc = Document.newBuilder()
      // Setting the document identifer is optional.
      // If omitted, the search service will create an identifier.
      .setId(myDocId)
      .addField(Field.newBuilder().setName("content").setText("the rain in spain"))
      .addField(Field.newBuilder().setName("email").setText(userEmail))
      .addField(Field.newBuilder().setName("domain").setAtom(userDomain))
      .addField(Field.newBuilder().setName("published").setDate(new Date()))
      .build();
  // [END create_document]
  return doc;
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:23,代码来源:DocumentServlet.java

示例2: createDocument

import com.google.appengine.api.users.User; //导入方法依赖的package包/类
/**
 * Code snippet for creating a Document.
 *
 * @return Document Created document.
 */
public Document createDocument() {
  // [START create_document]
  User currentUser = UserServiceFactory.getUserService().getCurrentUser();
  String userEmail = currentUser == null ? "" : currentUser.getEmail();
  String userDomain = currentUser == null ? "" : currentUser.getAuthDomain();
  String myDocId = "PA6-5000";
  Document doc =
      Document.newBuilder()
          // Setting the document identifer is optional.
          // If omitted, the search service will create an identifier.
          .setId(myDocId)
          .addField(Field.newBuilder().setName("content").setText("the rain in spain"))
          .addField(Field.newBuilder().setName("email").setText(userEmail))
          .addField(Field.newBuilder().setName("domain").setAtom(userDomain))
          .addField(Field.newBuilder().setName("published").setDate(new Date()))
          .build();
  // [END create_document]
  return doc;
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:25,代码来源:DocumentServlet.java

示例3: checkUser

import com.google.appengine.api.users.User; //导入方法依赖的package包/类
protected boolean checkUser() {
  UserService userService = UserServiceFactory.getUserService();
  User user = userService.getCurrentUser();

  String authDomain = user.getAuthDomain();
  if (authDomain.contains("google.com")) {
    return true;
  } else {
    return false;
  }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:12,代码来源:BaseServlet.java


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