RESTful Web Services (JAX-RS) @MatrixParam Example

In this article i will describe how a RESTful web services would accept multiple parameters sent by the client in the HTTP URL as Matrix Params. So what are matrix parameters ? let me give you the syntax.

Matrix Parameters Syntax

Consider this URL

If you observe the URL, i am passing 2 parameters nameKey=Java4s & countryKey=USA.  One parameter is separated from another with a semicolon, similarly you can pass any number of parameters. These type of parameters are called as Matrix Parameters. I will explain more about matrix parameters in this example.

Required Files


  • Once you run the application,  eclipse will open the following URL  http://localhost:2013/RestMatrixParamAnnotationExample/   by default
  • In [ line number 9 ] we have given class level path as /customers and we are using @MatrixParam annotation to retrieve the client inputs from the URL, so the final URL should be


You Might Also Like

  ::. About the Author .::

- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.


3 Responses to “RESTful Web Services (JAX-RS) @MatrixParam Example”
  1. vishwnath says:

    Nicely explaiined Web Services !!!

  2. PugaZhendhi says:

    Nice Tutorial. But we need interview point of question.

  3. Rabindra says:

    Can you please discuss the functional difference of MatrixParam and QueryParam?


By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.