Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My first inclination is to tell you to take a look at <a href="http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-matrix-variables" rel="nofollow">Matrix Variables</a>, but I'm thinking you might have already? At any rate, you'd need a different pattern:</p> <pre><code>// First an example request: // GET /jpm/owners;names=bob,jim,john;ids=1,2,3/entityName/list @RequestMapping("/jpm/owners/{entity}/list") public ModelAndView doSomething( @MatrixVariable Map&lt;String,List&lt;String&gt;&gt; matrixVariables, @PathVariable String entity) { // matrixVariables now contains a map with values: // "names" =&gt; ["bob", "jim", "john"] // "ids" =&gt; ["1", "2", "3"] // ...and then obviously the entity variable resolves to "entityName" } </code></pre> <p>I typed all that directly here, so I haven't tested it. If I get a chance, I'll try it out and come back and edit appropriately. Hope it helps regardless.</p> <p><strong>EDIT AFTER COMMENT</strong></p> <p>I guess it's debatable whether or not the use of matrix variables is "RESTful," a term for which there is no official standard, but matrix variables are supported by the likes of Spring and WADL, so that gives them some legs, I guess. Regardless, I believe Spring does not support the use of a "/" in a <code>@PathVariable</code> at all, whether or not you use a regular expression. Even if you did go that route, like you said, you'd have to parse the results out to split each item in the resulting list. Instead, why not pass a comma-delimited list as a String and let Spring do the parsing for you?</p> <pre><code>// GET /jpm/owners/bob,jim,john/1,2,3/myEntity/list @RequestMapping("jpm/owners/{names}/{ids}/{entity}/list") public String getTest( @PathVariable List&lt;String&gt; names, @PathVariable List&lt;String&gt; ids, String entity) { // names = ["bob", "jim", "john"] // ids = ["1", "2", "3"] } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload