Skip to content

Ability to assign wildcard path to PathVariable [SPR-14032] #18604

Closed
@spring-projects-issues

Description

@spring-projects-issues

Laplie Anderson opened SPR-14032 and commented

Currently, the way to get the wildcard part of a request mapping is a bit cumbersome:

@RequestMapping("/somePrefix/{element}/**")
public void myAction(@PathVariable String element, HttpServletRequest request) {
	    String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
	   // do some path manipulation here
	   // do actual work
}

It would be nicer if we could just have the element assigned directly:

@RequestMapping("/somePrefix/{element}/{**}")
public void myAction(@PathVariable String element, @PathVariable String wildcard) {
	  // do actual work
}

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions