本文整理汇总了Java中javax.enterprise.context.Conversation类的典型用法代码示例。如果您正苦于以下问题:Java Conversation类的具体用法?Java Conversation怎么用?Java Conversation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Conversation类属于javax.enterprise.context包,在下文中一共展示了Conversation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConversation
import javax.enterprise.context.Conversation; //导入依赖的package包/类
/**
* Tests simple conversation in a jar archive
*/
@Test
public void testConversation() {
logger.info("start conversation test");
Conversation conversation = conversationBean.getConversation();
assertEquals("deafult timeout is 600000 millis", 600000, conversation.getTimeout());
assertEquals("when the conversation is not started it is transient", true, conversation.isTransient());
assertNull("I have not started the conversation so the id will be null", conversation.getId());
conversationBean.initConversation();
assertEquals("verifiing the openeded conversation", "1", conversation.getId());
assertEquals("when the conversation is started it is not transient", false, conversation.isTransient());
conversationBean.endConversation();
assertNull("when I close the conversation the id will be null", conversation.getId());
assertEquals("when the conversation is ended it is transient again", true, conversation.isTransient());
logger.info("end conversation test");
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:19,代码来源:ContextSPITestCase.java
示例2: setup
import javax.enterprise.context.Conversation; //导入依赖的package包/类
@Before
public void setup() {
model = spy(new SubscriptionWizardConversationModel());
sdm = mock(ServiceDetailsModel.class);
conversation = mock(Conversation.class);
ui = mock(UiDelegate.class);
subscriptionService = mock(SubscriptionService.class);
userGroupService = mock(UserGroupService.class);
menuBean = mock(MenuBean.class);
sessionBean = mock(SessionBean.class);
subscriptionServiceInternal = mock(SubscriptionServiceInternal.class);
jsonConverter = spy(new JsonConverter());
jsonConverter.setUiDelegate(ui);
userBean = spy(new UserBean());
pabv = mock(PaymentAndBillingVisibleBean.class);
accountService = mock(AccountService.class);
unitCtrl = new SubscriptionUnitCtrl();
unitModel = new SubscriptionUnitModel();
unitCtrl.setModel(unitModel);
bean = spy(new SubscriptionWizardConversation());
decorateBean();
}
示例3: PersonHome
import javax.enterprise.context.Conversation; //导入依赖的package包/类
@Inject
@Valid
public PersonHome(@NotNull PersistenceService persistenceService,
@NotNull Conversation conversation,
@NotNull Messages messages,
@NotNull Logger logger,
@NotNull ValidatorFactory validatorFactory) {
this.persistenceService = persistenceService;
this.conversation = conversation;
this.messages = messages;
this.logger = logger;
this.validatorFactory = validatorFactory;
discipleshipStatusValues = new LinkedHashMap<>();
discipleshipStatusValues.put(messages.getMessageFor("enumerations.DiscipleshipStatus.DISCIPLE_CANDIDATE"), DiscipleshipStatus.DISCIPLE_CANDIDATE.toString());
discipleshipStatusValues.put(messages.getMessageFor("enumerations.DiscipleshipStatus.NOT_INTERESTED"), DiscipleshipStatus.NOT_INTERESTED.toString());
discipleshipStatusValues.put(messages.getMessageFor("enumerations.DiscipleshipStatus.TEACHING_CANDIDATE"), DiscipleshipStatus.TEACHING_CANDIDATE.toString());
}
示例4: isReservedType
import javax.enterprise.context.Conversation; //导入依赖的package包/类
public static boolean isReservedType(Class<?> type) {
return HttpRequest.class.isAssignableFrom(type)
|| Session.class.isAssignableFrom(type)
|| Flash.class.isAssignableFrom(type)
|| Conversation.class.isAssignableFrom(type)
|| ConversationState.class.isAssignableFrom(type)
|| UserPrincipal.class.isAssignableFrom(type)
|| Map.class.isAssignableFrom(type);
}
示例5: 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();
}
}
示例6: list
import javax.enterprise.context.Conversation; //导入依赖的package包/类
public HttpResponse list(Conversation conversation) {
if (conversation.isTransient()) conversation.begin();
GuestbookDao dao = domaProvider.getDao(GuestbookDao.class);
List<Guestbook> guestbooks = dao.selectAll();
return templateEngine.render("guestbook/list",
"guestbooks", guestbooks);
}
示例7: 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);
}
示例8: page1
import javax.enterprise.context.Conversation; //导入依赖的package包/类
public HttpResponse page1(Conversation conversation) {
if (conversation.isTransient()) conversation.begin();
int randomValue = new Random().nextInt();
ConversationState conversationState = new ConversationState();
conversationState.put("random", randomValue);
return builder(templateEngine.render("conversationState/page1",
"random", randomValue))
.set(HttpResponse::setConversationState, conversationState)
.build();
}
示例9: handle
import javax.enterprise.context.Conversation; //导入依赖的package包/类
@Override
public HttpResponse handle(HttpRequest request, MiddlewareChain chain) {
ConversationToken token = parseToken(readTokenFunc.apply(request));
if (!isGetRequest(request) && !token.isValid()) {
return builder(HttpResponse.of("Invalid conversation."))
.set(HttpResponse::setHeaders, Headers.of("Content-Type", "text/plain"))
.set(HttpResponse::setStatus, 403)
.build();
}
Conversation conversation;
if (token.id == null) {
conversation = new DefaultConversation();
} else {
conversation = new DefaultConversation(token.id);
ConversationState state = (ConversationState) store.read(token.id);
request.setConversationState(state);
}
request.setConversation(conversation);
HttpResponse response = castToHttpResponse(chain.next(request));
if (conversation.isTransient()) {
if (conversation.getId() != null) {
store.delete(conversation.getId());
}
} else if (response.getConversationState() != null) {
store.write(conversation.getId(), response.getConversationState());
}
return response;
}
示例10: startTask
import javax.enterprise.context.Conversation; //导入依赖的package包/类
/**
* @see #startTask(String)
* <p>
* this method allows to start a conversation if no conversation is active
*/
public Task startTask(String taskId, boolean beginConversation) {
if (beginConversation) {
Conversation conversation = conversationInstance.get();
if (conversation.isTransient()) {
conversation.begin();
}
}
return startTask(taskId);
}
示例11: startTask
import javax.enterprise.context.Conversation; //导入依赖的package包/类
/**
* @see #startTask(String)
*
* this method allows to start a conversation if no conversation is active
*/
public Task startTask(String taskId, boolean beginConversation) {
Conversation conversation = conversationInstance.get();
if(conversation.isTransient()) {
conversation.begin();
}
return startTask(taskId);
}
示例12: startTask
import javax.enterprise.context.Conversation; //导入依赖的package包/类
/**
* @see #startTask(String)
*
* this method allows to start a conversation if no conversation is active
*/
public Task startTask(String taskId, boolean beginConversation) {
if(beginConversation) {
Conversation conversation = conversationInstance.get();
if(conversation.isTransient()) {
conversation.begin();
}
}
return startTask(taskId);
}
示例13: getConversation
import javax.enterprise.context.Conversation; //导入依赖的package包/类
public Conversation getConversation() {
return conversation;
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:4,代码来源:ConversationBean.java
示例14: getConversation
import javax.enterprise.context.Conversation; //导入依赖的package包/类
public Conversation getConversation() {
return conversation;
}
示例15: setConversation
import javax.enterprise.context.Conversation; //导入依赖的package包/类
public void setConversation(Conversation conversation) {
this.conversation = conversation;
}