Difference between JAX-RS @QueryParam and @MatrixParam

Asked on June 05, 2016
What is difference between JAX-RS @QueryParam and @MatrixParam?

Replied on June 05, 2016
JAX-RS uses @QueryParam to access query string and @MatrixParam to aceess matrix parameter.


Find the URL


Find the code to access query string using @QueryParam

public String add(@QueryParam("id") Integer id, @QueryParam("name") String name ){
         return "result";

For more detail, find the URL.


Find the matrix URI


Find the code to access matrix parameter

    public Response detail(@MatrixParam("name") String name, @MatrixParam("age") String age) {
    Map<String,String> map = new HashMap<String,String>();
    map.put("name", name);
    map.put("age", age);
        return Response.ok(map).build();

For more detail, find the URL.

Write Answer

©2024 concretepage.com | Privacy Policy | Contact Us