Giving a .java Servlet File as welcome file in Google app engine
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).
精彩评论