주어진 코드를 보면 isResourceUrl(path)의 결과에 따라 forward나 doFilter 중 하나를 호출하고 있습니다. 이 두 가지 메서드의 차이점과 역할에 대해 설명드리겠습니다.
forward는 현재 서블릿에서 다른 서블릿이나 JSP로 요청을 전달할 때 사용됩니다.[4]doFilter는 필터 체인을 따라 다음 필터를 호출하거나, 체인의 마지막이라면 최종 리소스(서블릿, JSP 등)를 호출합니다.[1]chain.doFilter(request, response)를 호출해야 합니다.[1]따라서 주어진 코드는 요청 경로가 리소스에 해당하면 forward를 통해 해당 경로로 요청을 전달하고, 그렇지 않으면 doFilter를 호출해 다음 필터 또는 서블릿으로 처리를 넘기는 것으로 보입니다.
Citations: [1] https://hyuuny.tistory.com/3 [2] https://stackoverflow.com/questions/45829496/dofilter-with-httpservletrequest [3] https://9keyyyy.tistory.com/15 [4] https://starkying.tistory.com/entry/Forward-그리고-Servlet-JSP의-연동 [5] https://www.digitalocean.com/community/tutorials/java-servlet-filter-example-tutorial [6] https://khr5830.tistory.com/171 [7] https://blogshine.tistory.com/21 [8] https://dev-handbook.tistory.com/35