开发者

Defining servlet url patterns using regular expressions on Google App Engine platform

开发者 https://www.devze.com 2023-03-31 00:50 出处:网络
I\'m working in google app engine and I\'m attempting to set up my servlets like this: /action_X/someIdString_32joi32joifj32

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

/action_X/someIdString_32joi32joifj32

Would go to one servlet, while...

/action_X/subAction_A/someIdStr开发者_如何学Going_wjiefoapjfew

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?


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

  • use 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
0

精彩评论

暂无评论...
验证码 换一张
取 消