2
votes

In appengine, is index.html served as a static file or there's a servlet container involved first? For example, lets assume I have the blabla.com host, war/index.html and a user goes to http:/blbla.com/
I don't want a servlet container being hit first in order to determine that it's part of welocme-file-list configured in web.xml and only then appengine will serve it as a static file. Is the only way to avoid server roundtrip is to have a user hit the url http://blabla.com/index.html ?
As per docs https://developers.google.com/appengine/docs/java/gettingstarted/staticfiles say:
By default, App Engine makes all files in the WAR available as static files except JSPs and files in WEB-INF/. Any request for a URL whose path matches a static file serves the file directly to the browser—even if the path also matches a servlet or filter mapping.
So now the question: Which of the following is true If I have specified "index.html" in welcome-file-list and user hits http://blabla.com

  1. appengine knows that it has to servle index.html directly as a static file and my servlet container is not bothered checking welcome-files-list.
  2. appengine doesn't know that it has to serve index.html from static files and my servlet container gets hit just to only check welcome-files-list and then allows appengine to fetch it as a static file.

In case of 2: the only way to have html files served as a static files is having users hit them directly in url, i.e http://blabla.com/index.html? This is very important moment because it means that your servlet container may be doing additional job of resolving welcome-files-list on every request time which results in wasted cpu which could be avoided should users have specified direct path to the html files.

1
If that servlet container is the server responding when you access blabla.com then it is always hit event if you specify blabla.com or blabla.com/index.html isn't it? Or do you have something in between like an Apache server serving static content?JohnDoDo
@johndodo Appengine takes care of static files essentially providing a CDN for those. And docs developers.google.com/appengine/docs/java/gettingstarted/… say: "By default, App Engine makes all files in the WAR available as static files except JSPs and files in WEB-INF/. Any request for a URL whose path matches a static file serves the file directly to the browser—even if the path also matches a servlet or filter mapping." So in case of /index.html the file will be fetched from CDN directly. But in case of / the request will go to the server first checking welcome-files-list.Diamond Hands
As I'm not very proficient how appengine serves static files, so I want to understand if the only way to have index.html being served as a static file is having users request it directly specifying it in the url blabla.com/index.html. Or it takes care of it even if user hits http:/blabla.com and appengine somehow knows that it must serve intex.html from CDN not bothering servlet container?Diamond Hands

1 Answers

0
votes

By default, App Engine makes all files in the WAR available as static files except JSPs and files in WEB-INF/. Any request for a URL whose path matches a static file serves the file directly to the browser—even if the path also matches a servlet or filter mapping. You can configure which files App Engine treats as static files using the appengine-web.xml file.

But you cannot set as static file the url "/".

See the documentation.