RequestMapping with slashes and dot

Viewed 3039

I have to support following URL format

/service/country/city/addr1/addr2/xyz.atom /service/country/city/addr1/addr2/addr3/xyz.atom

where country and city can be mapped to @PathVariable but after that the path can be dynamic with multiple slashes. The end part will have .atom or similar.

I tried following, but none of the options seem to be working

  • Wildcard

    @RequestMapping(value="/service/{country}/{city}/**")

  • Regex

    @RequestMapping(value="/service/{country}/{city}/{addr:.+}")

  • UseSuffixPatternMatch


    Override method in Config class

     @Override
     public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setUseSuffixPatternMatch(false);
     }
    

Looks like combination of slash and dots don't work with above solutions. I keep getting 406 for non-matching Accept header, or 404

2 Answers
Related