why_vincent
why_vincent

Reputation: 2262

Serve static files from Java webapp on Google App Engine

I'm a bit lost here and I should know this by now, but I don't. I have exclusively been working with backend Java by exposing REST-services. Now I want to include a file, such as an *.html file, in my project that anyone should be able to access using https. I have included a file in my project root and I have added:

<resource-files>
    <include path="/**.html" />
</resource-files>

in my appengine-web.xml. Then I deploy it on

https://myhostingdomain.appspot.com/thenameofthefile.html

This does not work. I've also tried going into servlet mapping in web.xml and map url pattern to *.html but no luck so far. Any advice regarding this would be appreciated.

Upvotes: 1

Views: 296

Answers (1)

Andrei Volgin
Andrei Volgin

Reputation: 41089

You need to put this file into /war folder. Then it should be accessible from the Internet.

Also, if you want this file to be the default page (e.g. displayed when a user visits your domain without specifying the page), you can add this to your web.xml file (for example):

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

Upvotes: 2

Related Questions