Santosh  V M
Santosh V M

Reputation: 1561

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" folder as the welcome file in the web.xml file?

Upvotes: 4

Views: 1194

Answers (2)

Dave W. Smith
Dave W. Smith

Reputation: 24956

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.

Upvotes: 6

Thilo
Thilo

Reputation: 262474

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).

Upvotes: 0

Related Questions