Katedral Pillon
Katedral Pillon

Reputation: 14864

How to get my app-engine home page from a Servlet

I have created an app-engine connected android project. The way this works is when you open your webapp directory there is an index.html, which serves as the home page of the api. What I want is to create a Servlet that will generate that home page for me instead of serving it from this webapp/index.html. I have created my servlet. But I am not sure how to refer to it inside web.xml

I imagine I have to replace

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

Upvotes: 0

Views: 60

Answers (1)

konqi
konqi

Reputation: 5227

If you want to keep it simple you can remove the static index.html altogether and create a servlet mapping like this (in web.xml).

<servlet>
     <servlet-name>MyWelcomeServlet<servlet-name>
     <servlet-class>domain.package.subpackage.class</servlet-class>
 </servlet>
 <servlet-mapping>
     <servlet-name>MyWelcomeServlet</servlet-name>
     <url-pattern>/index.html</url-pattern>
 </servlet-mapping>

Note: removing or renaming the static index.html is important since Google's content delivery network will serve static files before routing requests to app engine instances.

Upvotes: 1

Related Questions