Close

JAX-RS - Regex to match all URI paths using @Path and @PathParam

This example shows how to match multiple path segments (containing /) by using regex in @Path template.

The pattern regex [.+] can match any characters. In following project example we are matching anything between pathA and pathZ.

Example Project

Dependencies and Technologies Used:

  • jersey-server 2.25.1: Jersey core server implementation.
  • jersey-container-servlet 2.25.1: Jersey core Servlet 3.x implementation.
  • jersey-media-moxy 2.25.1: Jersey JSON entity providers support module based on EclipseLink MOXy.
  • jersey-test-framework-provider-jdk-http 2.25.1: Jersey Test Framework - JDK HTTP container.
  • JDK 1.8
  • Maven 3.3.9

jaxrs-regex-all-uris Select All Download
  • jaxrs-regex-all-uris
    • src
      • main
        • java
          • com
            • logicbig
              • example
                • MyResource.java