Jersey – Case-insensitive @Path URLs

By default in JAX-RS, ALL URLs specified in @Path annotations are CASE-SENSITIVE. In this tutorial, I am giving a simple example of CASE-INSENSITIVE URLs which cane be used inside @Path annotation on any Jersey JAX-RS REST API.

How to make URLs case in-sensitive

To make URLs case-insensitive, change the @Path URLs like below:

public class JerseyService 

Change above declaration to this:

@Path("/{employees : (?i)employees}")
public class JerseyService 

Now above @Path annotation will be able to match any variation of lowercase and UPPERCASE letters in employees.

Please note that for this example, I am using Jersey 2.19.

Demo Usage

Here, I am modified the sourcecode of my previous example of Jersey RESTful Client Examples.

I sent following requests to HTTP GET /{employees : (?i)employees} path, and all paths matches correctly.


Case-insensitive URL - 1
Case-insensitive URL – 1


Case-insensitive URL - 2
Case-insensitive URL – 2


Case-insensitive URL - 3
Case-insensitive URL – 3

Feel free to contact in you find any problem in this example.

Happy Learning !!

Leave a Reply

Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.

Our Blogs

REST API Tutorial