@End public String confirmOrder() { order.setCreationDate(new Date()); for (Pizza pizza : order.getPizzas()) em.persist(pizza); em.persist(order); log.infov( "Order {0} placed by {1} with {2} pizzas", order.getId(), user.getUsername(), order.getPizzas().size()); return "completed"; }
// Injecting HttpServletRequest instead of HttpSession as the latter conflicts with a Weld bean on // GlassFish 3.0.1 public void onLogin(@Observes @Authenticated UserLogin user, HttpServletRequest request) { currentUser = user; log.infov( "set current UserLogin,userId={0},loginName={1},userName={2}", currentUser.getUserId(), currentUser.getLoginName(), currentUser.getUserName()); checkPermission(currentUser.getUserId()); // reward authenticated users with a longer session // default is kept short to prevent search engines from driving up # of sessions // request.getSession().setMaxInactiveInterval(3600); }
@Begin(timeout = 15 * 60 * 1000) // milliseconds public void begin() { log.infov("User {0} is creating an order", user.getUsername()); order = new Order(user); currentPizza = new Pizza(order); }