/java/

JAX-RS @MatrixParam

2015-08-18 22:14:40

package pl.btbw;

import javax.ws.rs.GET;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.Path;

@Path("/")
public class MyCtrl {

    @GET
    @Path("/car/filter")
    public String test(@MatrixParam("category") String category, @MatrixParam("type") String type) {
        String response = "Response:";
        response += " Category:" + category;
        response += " Type:" + type;
        return response;
    }
}

example urls: http://localhost:8080/matrix/car/filter http://localhost:8080/matrix/car/filter;category=big http://localhost:8080/matrix/car/filter;category=big;type=1