package org.itachi.cms.action;

import org.glassfish.jersey.server.mvc.Viewable;
import org.itachi.cms.constant.Constants;
import org.itachi.cms.dto.UserDTO;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.Map;

/**
 * Created by itachi on 2017/4/12.
 * User: itachi
 * Date: 2017/4/12
 * Time: 22:56
 */
@Path("/")
public class LoginAction extends BaseAction {
    @GET
    @Path("login")
    @Produces(MediaType.TEXT_HTML)
    public Viewable login() throws Exception {
        return new Viewable("/login");
    }

    @POST
    @Path("login")
    @Produces(APPLICATION_JSON_UTF8)
    public Map<String, Object> toLogin() throws Exception {
        // 获取用户名，密码，到service层验证，数据库取用户数据

        // request.getSession(true).setAttribute();
        UserDTO user = new UserDTO();
        request.getSession(true).setAttribute(Constants.SESSION_KEY, user);

        return null;
    }
}

@@ -150,16 +150,123 @@
 UserDTO;
+%0Aimport org.springframework.http.HttpStatus;%0Aimport org.springframework.web.bind.annotation.ResponseStatus;
 %0A%0Aimport
@@ -400,30 +400,8 @@
 ype;
-%0Aimport java.util.Map;
 %0A%0A/*
@@ -742,70 +742,61 @@
    @
-Produces(APPLICATION_JSON_UTF8)%0A    public Map%3CString, Object%3E
+ResponseStatus(HttpStatus.NO_CONTENT)%0A    public void
  toL
@@ -863,16 +863,18 @@
 %E5%BA%93%E5%8F%96%E7%94%A8%E6%88%B7%E6%95%B0%E6%8D%AE%0A%0A
+%0A%0A
         
@@ -951,24 +951,24 @@
  UserDTO();%0A
+
         requ
@@ -1034,30 +1034,8 @@
 er);
-%0A%0A        return null;
 %0A   

添加权限验证的filter，添加登陆的模板代码。