My code to forward request to another page in Spring MVC looks like below:
how can i remove dependency on HttpServletRequest and HttpServletResponse in above code to make it more unit testable?Code:@RequestMapping(method = RequestMethod.POST) public String handle(HttpServletRequest request, HttpServletResponse response, @RequestParam("myDesignFile") String myDesignFile) throws Exception { final String url = String.format("/frameset?__format=html&__report=report/%s", myDesignFile); request.getRequestDispatcher(url).forward(request, response); return null; }
is there any code like below in Spring that will not require request or response dependencies:
Code:return "forward:" + url;


Reply With Quote