Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can't say for certain, but I suspect this is by design. Suppose you have a two level URI like this:</p> <pre><code>/foo/bar </code></pre> <p>On both levels one could have a matrix parm named filter. You could end up with a URL like so:</p> <pre><code>/foo;filter=13/bar;filter=April </code></pre> <p>In the Jersey resource for that path you'll have one paramter annotated with @MatrixParam("filter"). Which filter parameter should Jersey fill in? What if one or the other is not supplied? </p> <p>Having just implemented some matrix parameters, I can see the value in the current implementation. Specifying @MatrixParam pulls only the last level. If you want matrix parameters earlier in the URI, specify @PathParameter and have the parameter type be a PathSegment. From the path segment you can pull out the matrix parameters.</p> <p>Often times, the resource class will have a global @Path, and each method will have it's own @Path adding to the class level setting. In this case it seems to make more sense that @MatrixParameter would apply only to the last path segment.</p> <p>So, putting this all together (for our example above) yields the following</p> <pre><code>@Path("{fooPath: foo}") public class FooResource { @GET @Path("bar") public String getFooBar(@PathParam("fooPath") PathSegment fooPath, @MatrixParam("filter") String filter) { MultivaluedMap&lt;String, String&gt; mParms = fooPath.getMatrixParameters(); List&lt;String&gt; parms = mParms.get("filter"); String fooFilter = parms.get(0); // ... the rest of your code } } </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. 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