本文整理汇总了Java中javax.enterprise.context.Conversation.end方法的典型用法代码示例。如果您正苦于以下问题:Java Conversation.end方法的具体用法?Java Conversation.end怎么用?Java Conversation.end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.enterprise.context.Conversation
的用法示例。
在下文中一共展示了Conversation.end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: login
import javax.enterprise.context.Conversation; //导入方法依赖的package包/类
public HttpResponse login(Parameters params, Conversation conversation) {
if (!conversation.isTransient()) conversation.end();
CustomerDao dao = daoProvider.getDao(CustomerDao.class);
String email = params.get("email");
Customer customer = dao.loginByPassword(email, params.get("password"));
if (customer == null) {
return templateEngine.render("guestbook/login");
} else {
Session session = new Session();
session.put("principal", new LoginPrincipal(email));
return builder(redirect(GuestbookController.class, "list", HttpResponseUtils.RedirectStatusCode.SEE_OTHER))
.set(HttpResponse::setSession, session)
.build();
}
}
示例2: post
import javax.enterprise.context.Conversation; //导入方法依赖的package包/类
@Transactional
public HttpResponse post(Parameters params, UserPrincipal principal, Conversation conversation) {
if (!conversation.isTransient()) conversation.end();
GuestbookDao dao = domaProvider.getDao(GuestbookDao.class);
Guestbook guestbook = builder(new Guestbook())
.set(Guestbook::setName, principal.getName())
.set(Guestbook::setMessage, params.get("message"))
.set(Guestbook::setPostedAt, LocalDateTime.now())
.build();
dao.insert(guestbook);
return redirect(GuestbookController.class, "list", SEE_OTHER);
}
示例3: page3
import javax.enterprise.context.Conversation; //导入方法依赖的package包/类
public HttpResponse page3(Conversation conversation) {
if (!conversation.isTransient()) conversation.end();
return templateEngine.render("conversationState/page3");
}