spring request mapping with extensions -


@requestmapping(value = {"/","/index","/homepages"}, method = requestmethod.get) public string home(/*locale locale, model model*/) {       return "underconstruction"; } 

when request comes in context path or /index etc. underconstruction page served.

but when request comes in index.htm, page not served.

i using java config. how can resolve in java config.

@override protected class<?>[] getrootconfigclasses() {// classes contextloaderlistener -- middle tier , backend     // todo auto-generated method stub     return new class<?> [] {rootconfig.class};  }  @override protected class<?>[] getservletconfigclasses() {//define dispatcher servlets application context     // todo auto-generated method stub     return new class<?> []{webconfig.class}; }  @override protected string[] getservletmappings() {     // todo auto-generated method stub     return new string[] {"/"}; } 

spring considers dot file extension. yo can disable configuring class

org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping

setting usesuffixpatternmatch false.

if want leave seetings , handle in request mapping can write regular expression

such

{variable:.+} 

in @requestmapping struggled same thing when wanting send email through get.

hope helps


Comments