0

I have a url say /prefix/part1/part2/.../partN/suffix and in a controller i want to map anything between /prefix/ and /suffix to one variable.

Approaches tried

@RequestMapping(value = "/prefix/{store:[\s\S]*}/suffix",
            method = RequestMethod.GET)

Also, tried regex : (.*), The interesting part is i don't know what N is. So, cant explicitly specify number of slashes possible.

1 Answer 1

2

I have an open JIRA issue requesting this ability, but the Spring core team apparently doesn't think that it's useful and is not interested in supporting it. You might make a note there.

In the meantime, the only option is to get the entire string from the request and parse it yourself.

Sign up to request clarification or add additional context in comments.

1 Comment

That would be little painful. Because, between /prefix/ and /suffix if i have say "do-something" then behaviour should be different. I will make my comment in jira. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.