Reputation: 4805
I would like to realize the following:
@RequestMapping( "/archive/{date}.html" ) // e.g. /archive/2012/08.html
public String listByDate( @PathVariable( "date" ) @DateTimeFormat( iso = ISO.DATE, pattern = "yyyy/MM" ) Calendar cal, ... )
But I'm just getting a 404.
I guess this is because I'm trying to use a slash in between the {date}
placeholder?
What do I need to do here?
Upvotes: 1
Views: 1723
Reputation: 7048
To include a "/" in a URL parameter it would need to be URL-encoded (otherwise it looks like a path element).
Your request should work if it looks like this:
/archive/2012%2F08.html
Upvotes: 3
Reputation: 28713
Why not split {date}
into {year}/{month}
?
@RequestMapping( "/archive/{year}/{month}.html" )
public String listByDate( @PathVariable( "year" )...
Upvotes: 3