Hello
I'm trying to write a REST API in jServer. but i'm bumping into a wall.
Some context: I have a user endpoint, and a user can have transactions. Following basic RESt principles I do something like this:
GET /users -> Works srvr.AddHandler("/users"
GET /users/87 -> works srvr.AddHandler("/user/*")
GET /users/87/transactions -> Fails with srvr.AddHandler("/users/*/transactions")
GET /users/87/transactions/3 -> Also fails with srvr.AddHandler("/users"/*/transactions/*")
I get the same error on both cases:
java.lang.IllegalArgumentException: Servlet Spec 12.2 violation: glob '*' can only exist at end of prefix based matches: bad spec "/users/*/transactions"
The error is very clear, the * can only exist at the end of the path. But how would I accomplish what I want?
I tried delving into the Jetty API docs on pathmap here: https://www.eclipse.org/jetty/javadoc/current/org/eclipse/jetty/http/pathmap/PathMappings.html
But to be honest, I can't seem to find really useful information there. Must be my inexperience with Java docs in general.
Does anyone has clues or tips on how to construct my paths? What I'm trying to do is very common in API design, so I guess Jetty must support it in one way or another?
Thanks a bunch!
I'm trying to write a REST API in jServer. but i'm bumping into a wall.
Some context: I have a user endpoint, and a user can have transactions. Following basic RESt principles I do something like this:
GET /users -> Works srvr.AddHandler("/users"
GET /users/87 -> works srvr.AddHandler("/user/*")
GET /users/87/transactions -> Fails with srvr.AddHandler("/users/*/transactions")
GET /users/87/transactions/3 -> Also fails with srvr.AddHandler("/users"/*/transactions/*")
I get the same error on both cases:
java.lang.IllegalArgumentException: Servlet Spec 12.2 violation: glob '*' can only exist at end of prefix based matches: bad spec "/users/*/transactions"
The error is very clear, the * can only exist at the end of the path. But how would I accomplish what I want?
I tried delving into the Jetty API docs on pathmap here: https://www.eclipse.org/jetty/javadoc/current/org/eclipse/jetty/http/pathmap/PathMappings.html
But to be honest, I can't seem to find really useful information there. Must be my inexperience with Java docs in general.
Does anyone has clues or tips on how to construct my paths? What I'm trying to do is very common in API design, so I guess Jetty must support it in one way or another?
Thanks a bunch!
Last edited: