Hosting A Static Website In Google App Engine - Eclipse, Java

June 29, 2015

A few months ago, I played around with Google app engine. Somebody asked to set up a personal website which is nothing but a collection of static pages, images and JS widget to do a carousel/gallery. I tried my hand at Google app engine. In another instance, I hosted Google Course Builder on app engine. In both instance, my experience is smooth. Used Google app engine launcher.  Configured .yaml file (Replace application name with the unique application name you set up on google.)What if you want to setup your site using Java on AppEngine. Generally, java developers start with Eclipse. Generally, we follow the tutorial by Google.

The question is how to put our static files on AppEngine and point index.html as the startup page. Answer - include static file location to app-webengine.xml. 
In this case I created "static" folder under war folder. Also, set the expiration date. Using this setting, server will ask the browser to invalidate the cache for every 30 days and 5 hours. 

        <include path="/static/**" expiration="30d 5h" />

Next step is to set this folder as the public root. index.html which is configured in web.xml, will be picked up from this folder. 



The final output can be found at 


You Might Also Like


Popular Posts