hunyadym
hunyadym

Reputation: 2243

Creating REST-like url mapping for servlets on App Engine

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?

Upvotes: 2

Views: 314

Answers (1)

Vidya
Vidya

Reputation: 30310

Consider using a REST framework like RESTEasy. Others have deployed it successfully on GAE.

Other options include Spring MVC and Restlet.

All of them will abstract away the low level details of the Servlet API and let you focus on your services.

Upvotes: 1

Related Questions