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