spring - Which classes of method argument may be annotated with @RequestHeader -
i want access time-stamp in if-modified-since
header, can implement conditional get.
spring controllers can use @requestheader
annotation indicate spring should pass value of http header handler method method argument. must argument string
? or other classes permitted? spring documentation implies long
values can converted. set of classes permitted?
will following work (using date
)?
@requestmapping(method = requestmethod.get, headers = {"if-modified-since" }) public final void conditionallyretrieve( @requestheader("if-modified-since")final date ifmodifiedsince, final httpservletresponse response) { ... }
specifically, in example, think can use datetimeformat
drive spring conversion:
@requestheader("if-modified-since") @datetimeformat(pattern = "thepattern") final date ifmodifiedsince
Comments
Post a Comment