Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Disable filter
Browse files Browse the repository at this point in the history
  • Loading branch information
hardingadonis committed Jan 22, 2024
1 parent 4576593 commit b583064
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/main/java/io/hardingadonis/saledock/filter/DefaultFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ public DefaultFilter() {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;

String url = req.getServletPath();

if (url.equals("/") || url.contains(".jsp")) {
HttpSession session = req.getSession();

if (session.getAttribute("employee") != null) {
res.sendRedirect(req.getContextPath() + "/dashboard");

return;
}

res.sendRedirect(req.getContextPath() + "/login");
} else {
chain.doFilter(request, response);
}
// HttpServletRequest req = (HttpServletRequest) request;
// HttpServletResponse res = (HttpServletResponse) response;
//
// String url = req.getServletPath();
//
// if (url.equals("/") || url.contains(".jsp")) {
// HttpSession session = req.getSession();
//
// if (session.getAttribute("employee") != null) {
// res.sendRedirect(req.getContextPath() + "/dashboard");
//
// return;
// }
//
// res.sendRedirect(req.getContextPath() + "/login");
// } else {
// chain.doFilter(request, response);
// }
}

@Override
Expand Down

0 comments on commit b583064

Please sign in to comment.