當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。