Google App Engine: Create static html (or any other) file
Two kinds of "static" files in GAE === static or resource file
- GAE uses dedicated servers for static content.
- application
code cannot access the contents of static files using the filesystem.
- the deployment process and the frontend must be told which of the application's
files are static files.
-
frontend remembers which URL paths refer to static files,
- can also include a recommendation for a cache expiration
interval. App Engine returns the cache instructions to the client in the HTTP header
along with the file. If the client chooses to heed the recommendation (and most web
browsers do), it will retain the file for up to that amount of time, and use its local copy
instead of asking for it again.
- reduces the amount of bandwidth used at
expense of clients retaining old copies of files \
- files that do get pushed to the application servers are known as "resource files."
- These can include app-specific configuration files, web page templates, or other static
data that is read by the app but not served directly to clients.
- Application code can
access these files by reading them from the filesystem.
- There are ways to specify that a file is both a resource file and a static file, depending
on which runtime environment you are using.
- Resource files: all files in the WAR are pushed to the application servers (even those you declare as static), and are accessible
by the application code via the filesystem
- jsp files are always treated as servlets and hence resource files that will be loaded to app server
- Static files:All files except for JSPs and the WEB-INF/ directory are considered
static files
- also a resource file can be declared as a static file
- MUST always be resource files and never static: Files in the WEB-INF/ directory (can not exclude from resrouce files nor include as staitc via declarations)
In appengine-web.xml file --- (e.g. 30 days ---note: units d=days, h= hours, m=minutes, s=seconds)
<static-files>
<include path="images/**" expiration="30d" />
</static-files>
t
1) Create File (see below)
2) Add as appropriate any information in deployment descriptor (see above)
Here we see an example GAE project with RESOURCE files located in the war/WEB-INF directory
guestbook.jsp
index.html
SignupForm.html
1) create file (or sub-folder with files) in ProjectName->war folder, right click and say file->new->**** (I choose Other->web->HTML)
2) Now I choose File->New->Other->Web->HTML, fill in information
3) Now you are ready to enter in the content in your file
|