Examples of PetstoreUser


Examples of com.alibaba.sample.petstore.web.common.PetstoreUser

                        HttpSession session, ParameterParser params) throws Exception {
        user = userManager.login(user.getUserId(), user.getPassword());

        if (user != null) {
            // 在session中创建petstoreUser对象
            PetstoreUser petstoreUser = (PetstoreUser) session.getAttribute(PETSTORE_USER_SESSION_KEY);

            if (petstoreUser == null || petstoreUser.hasLoggedIn()) {
                petstoreUser = new PetstoreUser();
            }

            petstoreUser.upgrade(user.getUserId(), user.getRoles());

            session.setAttribute(PETSTORE_USER_SESSION_KEY, petstoreUser);

            // 跳转到return页面
            redirectToReturnPage(nav, params);
View Full Code Here

Examples of com.alibaba.sample.petstore.web.common.PetstoreUser

                           HttpSession session, Navigator nav) throws Exception {
        try {
            userManager.register(user);

            // 在session中创建petstoreUser对象
            PetstoreUser petstoreUser = (PetstoreUser) session.getAttribute(PETSTORE_USER_SESSION_KEY);

            if (petstoreUser == null || petstoreUser.hasLoggedIn()) {
                petstoreUser = new PetstoreUser();
            }

            petstoreUser.upgrade(user.getUserId(), user.getRoles());

            session.setAttribute(PETSTORE_USER_SESSION_KEY, petstoreUser);

            // 跳转到registerAccount页面
            nav.redirectTo(PETSTORE_REGISTER_ACCOUNT_LINK);
View Full Code Here

Examples of com.alibaba.sample.petstore.web.common.PetstoreUser

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/plain; charset=UTF-8");

        PrintWriter out = response.getWriter();
        PetstoreUser user = (PetstoreUser) request.getSession().getAttribute(PETSTORE_USER_SESSION_KEY);

        if (user != null && user.hasLoggedIn()) {
            out.print(user.getId());
        } else {
            out.print("guest");
        }

        out.flush();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.