Definición de patrones de URL de servlet mediante expresiones regulares en la plataforma Google App Engine

I'm working in google app engine and I'm attempting to set up my servlets like this:


Would go to one servlet, while...


would go to another servlet, specifically written to handle subAction_A

How can I define this in my web.xml to make this happen? I've found some stuff on google using the url-regexp, but that doesn't really look like its supported anymore, or at least not on the platform I'm using (Google App Engine, Web Application Project from Eclipse plugin).

Any suggestions on how to do this in Google App Engine? I can't seem to find a clean way to do this without having to write the code myself to parse out the url. Should I just make one servlet, map everything to that, and then do rewriting myself?

preguntado el 27 de agosto de 11 a las 22:08

1 Respuestas

You can't. The servlet url mapping support is very limited. You can:

  • utilizado UrlRewriteFilter
  • use spring-mvc (or another action web framework) to define controller method patterns
  • provide the parsing logic yourself, if it's simple and it is just an individual case

Respondido 28 ago 11, 02:08

As to the 3rd option, note that you'd like to use a Filter for this, not a Servlet. - BalusC

UrlRewriteFilter is exactly what I'm looking for. It even does stuff I didn't even know I wanted to do! - David

This is working on my localhost, but I'm getting a 404 when I deploy to Google App Engine. I'm including all .xml files in my deployment. Do you happen to have experience setting this up in app engine? - David

Nevermind. I don't know why; but the default status page provided doesn't work in app engine. I redirected the /test/status/ to my servlet instead and tested the mapping. It appears to work fine. - David

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.