Multiple Paths for a JAX-RS (Jersey) Endpoint
Sometimes you want the same endpoint to be server on two separate paths. For example:- You want to move to a newer path
- You want a default endpoint that has another name
Syntax for Multiple Paths
For endpointsapple
and banana
, declare your JAX-RS endpoint with this @Path annotation:
@Path("/{a:apple|banana}")You can also leave one alternative blank, so it is served up under the resource's base URL:
@Path("/{a:apple|}")
Copyright © 2024 Andrew Oliver