Я хочу указать мой текущий URL после запроса,
Мой код:
@RequestMapping(value = "/individual")
public ModelAndView home2(ModelAndView modelAndView,HttpServletRequest request,ServletResponse response,FilterChain chain) throws ServletException, IOException {
HttpServletRequest httpServletRequest = ((HttpServletRequest) request);
String requestURI = httpServletRequest.getRequestURI();
request.getRequestDispatcher(requestURI.concat("/IN"))
.forward(request,response);
modelAndView.setViewName("login");
return modelAndView;
}
Ожидается, что положить:
localhost:8080/individual/IN
ошибка:
2019-10-14 15:58:44.000 ERROR 8752 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.FilterChain]: Specified class is an interface] with root cause
org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.FilterChain]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:99) ~[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
Я также пытался перехватить, но это не сработало: -
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
requestURI = request.getRequestURI();
String newRequestURI = requestURI.concat("EN/");
request.getRequestDispatcher(newRequestURI).forward(request, response);
return true;
}