I would like to create a REST-like url mapping on Google App Engine with Java. The difficulty is that I want to use the following URL mapping:
/users -> UserListServlet
/users/4547 -> UserServlet
/users/3422/posts -> PostListOfUserServlet
/users/5433/posts/1234 -> PostOfUserServlet
But according to the manual (http://www.roguewave.com/portals/0/products/hydraexpress/docs/3.5.0/html/rwsfservletug/4-3.html), in the web.xml I can only have one wildchar at the end of the URL, so I can map to /users
and /users/*
, but I can't map to /users/*/posts
and /users/*/posts/*
.
What is the easy and conventional way to separate these cases and get the parameters, are there good practices, or I must create a servlet what gets all /users/*
requests and then split it at "/" characters and manually pass them to the different servlets?