java - Request mapping in Spring, regexp as parameter in annotation -
i have such code:
@requestmapping("/apple") public void handleapple(httpservletrequest request, httpservletresponse response) throws ioexception { <...> } @requestmapping("/test/apple") public void handletestapple(httpservletrequest request, httpservletresponse response) throws ioexception { <...> }
is possible combine these 2 methods in one, not like:
@requestmapping("/**/apple") public void handleapple(httpservletrequest request, httpservletresponse response) throws ioexception { <...> }
since allow urls besides started 'test' not applicable in case.
if it's 2 paths , you'd want them handled single handler method, take 1 of methods , annotate with
@requestmapping(value = {"/apple", "/test/apple"})
java spring spring-mvc
No comments:
Post a Comment