| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.ServletException; |
| | |
| | | service.logout(); |
| | | } |
| | | |
| | | /**拦截登录*/ |
| | | @GetMapping("login") |
| | | /**拦截登录*//* |
| | | @GetMapping("/") |
| | | @ApiIgnore |
| | | public void login(){ |
| | | System.out.printf("请登录..."); |
| | | public ModelAndView toLoginHtml(HttpServletRequest request, HttpServletResponse response,ModelAndView view) throws ServletException, IOException { |
| | | //request.getRequestDispatcher("login.html").forward(request,response); |
| | | System.out.println("转发啦..."); |
| | | //response.setContentType("text/html;charset=utf-8"); |
| | | //response.sendRedirect("http://localhost:8090/login.html"); |
| | | //response.sendRedirect("/login.html"); |
| | | view.setViewName("login"); |
| | | return view; |
| | | }*/ |
| | | |
| | | /**拦截登录*/ |
| | | @GetMapping("unauthorized") |
| | | @ApiIgnore |
| | | public void unauthorized(HttpServletRequest request,HttpServletResponse response) throws IOException { |
| | | response.setContentType("text/html;charset=utf-8"); |
| | | response.getWriter().write("您未获取到接口的调用授权,拒绝访问!"); |
| | | } |
| | | } |