开发者

Giving a .java Servlet File as welcome file in Google app engine

开发者 https://www.devze.com 2023-03-12 11:45 出处:网络
Is there ant way that I can give the .java(Basically a servlet file ) which is under the \"src\" f开发者_JS百科older as the welcome file in the web.xml file?I do

Is there ant way that I can give the .java(Basically a servlet file ) which is under the "src" f开发者_JS百科older as the welcome file in the web.xml file?


I do

<servlet-mapping>
  <servlet-name>WelcomeServlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>

and remove both the <welcome-file-list> element and index.html.

Works fine.


In web.xml you can specify the welcome file to map to a servlet:

<servlet>
    <servlet-name>WelcomeServlet</servlet-name>
    <servlet-class>foo.bar.WelcomeServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>WelcomeServlet</servlet-name>
    <url-pattern>*.foo</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>/welcome.foo</welcome-file>
</welcome-file-list>

I would assume that this also works on App Engine.

Of course, this would invoke the compiled servlet, not the source code in the "src" folder (which is most likely not even deployed to the server).

0

精彩评论

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