I am developing an application using Spring MVC, and Extjs and I have a problem, I need to pass a file path to my controller, which going to delete the image with the path. However in my view the path is correct, but when the request arrive in controller the path is without extension.
View : notepad-icon.png
Controller: notepad-icon
@RequestMapping (value = "/delete/{file}", method = RequestMethod.DELETE)
public ModelAndView delete(@PathVariable String file){
ModelAndView view = new ModelAndView(VIEW);
service.delete(file);
view.addObject("success", Boolean.TRUE);
return view;
}
Can anyone provide me a insight, please ??
If it is a simple extension can I recommend doing this:
Another way to do this will be a little roundabout - this will be by setting the
useSuffixPatternMatch
flag inRequestMappingHandlerMapping
to false, which should give you the entire filename, however setting the flag is a little difficult.Just add {file:.+} to the RequestMapping.