epeleg
epeleg

Reputation: 10945

multiple Jersey @Path s on single method

Using jersey - I know I can annotate a method with

@Path("/{a:path1|path2}")

but I was wandering if it was also possible to just use two annotations on a single method

@Path("path1")
@Path("path2")

To get almost the same effect (I know - this way I can not get a @PathParam ).

Upvotes: 0

Views: 494

Answers (1)

win_wave
win_wave

Reputation: 1508

Only in Java 8 it is allowed to have more than one same annotation. And even more than that annotation should be marked specially (@Repeatable, see more info here). Annotation @Path does not have such meta-annotation.

So, conclusion it is not possible.

Upvotes: 4

Related Questions