开发者

Variable 'app' in url-pattern for servlet mapping

I'm learning Spring MVC (and servlets in general) and following springsource's mvc-ajax example, which uses annotated controller methods. It appears that there is only one url-pattern (in web.xml) mapped to a servlet in that example:

/a开发者_如何学Gopp/*

I've deployed the app as a WAR file, and the actual, ugly URL I'm requesting is http://127.0.0.1:8080/org.springframework.samples.mvc.ajax-1.0.0-20100407.233245-1/account.

So, it appears that 'app' in '/app/*' is a variable corresponding to 'org.springframework.samples.mvc.ajax-1.0.0-20100407.233245-1', however, it isn't universal because it isn't usable in my own app, and it contradicts my understanding that url-pattern contains the portion of the URL after the app name. So, what is 'app'? Where is it configured?


Have a look at the urlrewrite.xml file.

This is where it is defined that all incoming urls (except the ones that start with /styles/, /scripts/, /images/ ) will be rewritten with /app/ at the beginning

<rule>
   <from>/**</from>
   <to>/app/$1</to>
</rule>

So when it reaches the dispatcher servlet, the url is in the form /app/myOriginalPath.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜