Announcement Announcement Module
No announcement yet.
Spring Web API parsing URLS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Web API parsing URLS

    Hello I'm new in Spring.
    I' m developing a Spring Web Api and I have problems parsing the URLs with regular expressions. I have already looked at the following posts:

    but I haven't found yet a solution to my problem.
    I want that all my requests get mapped to a single method, the length of the URL can be variable and the number of parameters can be also variable. I would like to capture the whole url with the variable pathValue and not until the slash /:

    @RequestMapping(value = "{pathValue}", method = RequestMethod.GET)

    All regular expressions that I have tested in Spring capture content between slashes (/......./) and don't consider de remaining URL.

    The main point is, that I want to parse the url in a single method and that implies that all requests get mapped to that method.
    Is there any way to achieve this in Spring?

    Many thanks for your help and advice.

  • #2
    First of all why? Seems like what you actually want is your own HandlerMapping implementation and you are coercing a Controller into that role for some reason.

    If you want all your urls to map to a single controller why not simply add a Controller (no @Controller) as the default controller on a handlermapping and do the parsing in the handleRequest method yourself?!