本文整理匯總了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;
}
}