java - Trying to create REST-ful URLs with multiple dots in the "filename" part - Spring 3.0 MVC -
i'm using spring mvc (3.0) annotation-driven controllers. create rest-ful urls resources , able not require (but still optionally allow) file extension on end of url (but assume html content type if no extension). works out-of-the-box spring mvc long there no dots (period/full-stop) in filename part.
however of urls require identifier dots in name. e.g. this:
http://company.com/widgets/123.456.789.500
in case spring looks content type extension .500
, finds none errors. can use work-arounds adding .html
end, encoding identifier or adding trailing slash. i'm not happy if these live adding .html
.
i've unsuccessfully looked way of overriding default file extension detection in spring.
is possible customize or disable file extension detection given controller method or url pattern, etc?
the @pathvariable
pattern matching bit twitchy when comes dots in url (see spr-5778). can make less twitchy (but more picky), , better control on dot-heavy urls, setting usedefaultsuffixpattern
property on defaultannotationhandlermapping
false
.
if haven't explicitly declared defaultannotationhandlermapping
in context (and people don't since it's declared implicitly you), can add explicitly, , set property.
Comments
Post a Comment