JBoss.orgCommunity Documentation

Chapter 9. @MatrixParam


RESTEasy supports @MatrixParam annotations with no parameter name..

The idea of matrix parameters is that they are an arbitrary set of name-value pairs embedded in a uri path segment. A matrix parameter example is:

GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke

The idea of matrix parameters is that it represents resources that are addressable by their attributes as well as their raw id. The @MatrixParam annotation allows URI matrix parameters to be injected into a method invocation.

public String getBook(@MatrixParam("name") String name, @MatrixParam("author") String author) {...}

There is one big problem with @MatrixParam that the current version of the specification does not resolve. What if the same MatrixParam exists twice in different path segments? In this case, it is better to use PathParam combined with PathSegment.