The thing is, your template expressions have ambiguous paths. After the three main sorting keys [1], the path is still ambiguous. URIs don't know about types. Everything is the URI (and during URI matching) is a String. The template expression values will later get converted to our method parameter types (if it is a convertible type [2]).
That being said, a way you can disambiguate the two is by using regular expression for the template. For example
@Path("/{date: \\d{2}-\\d{2}-\\d{4}}")
public Response getPartnerInteractionsByDate
@Path("/{interactionId: \\d{10}}")
public Response getPartnerInteraction
This is assuming dates com in MM-DD-YYYY
format and interaction ids are ten digits. This is just an example, but shows how you can make it work.
If there are absolutely no regex patterns that can match the URIs, then you will need to change the path (add a part to one of them) to disambiguate.
[1]
- The primary key of the sort is the number of literal characters in the full URI
matching pattern.
- The secondary key of the sort is the number of template expressions embedded
within the pattern
- The tertiary key of the sort is the number of nondefault template expressions. A
default template expression is one that does not define a regular expression
[2]
- It is a primitive type. The
int
, short
, float
, double
, byte
, char
, and boolean
types all fit into this category.
- It is a Java class that has a constructor with a single
String
parameter.
- It is a Java class that has a
static
method named valueOf()
that takes a single String
argument and returns an instance of the class.
- It is a
java.util.List<T>
, java.util.Set<T>
, or java.util.SortedSet<T>
,
where T
is a type that satisfies criteria 2 or 3 or is a String
.