0

In Python to host a basic website on app-engine, I can put all my image files in a static directory, say img, and then in the yaml file have

- url: /img
 static_dir: img

then to access my images, I simply do myid.appspot.com/img/pic.jpeg

I need to do the same thing for a Java google-endpoint backend. How would that work? I am using the Google-eclipse-plugin. I suppose I need to edit the web.xml file. But I am not sure what I would put in there.

The structure of my /img directory is such that it in turn contains many directories, each with images in them. For example: /img/famousActors/willSmith.jpeg.

Ref storing static images in the blobstore

Cœur
  • 37,241
  • 25
  • 195
  • 267
Pouton Gerald
  • 1,625
  • 22
  • 32

1 Answers1

0

According to the documentation, putting them in a folder other than WEB-INF is all you have to do.

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.

A request to /img/famousActors/willSmith.jpeg should work without additional configuration.

UnPlan2ned
  • 183
  • 1
  • 7
  • I will try it out and report back. Thank you. – Pouton Gerald May 12 '13 at 18:52
  • Do you know why I am getting this exception when trying to read the filenames on the server side? `java.security.AccessControlException: access denied ("java.io.FilePermission"`. I can view the image if I type the url. But when I try to read from the server itself, I get the error. – Pouton Gerald May 12 '13 at 23:57
  • You can answer here if you know the answer: http://stackoverflow.com/questions/16513260/java-security-accesscontrolexception-file-accessible-thru-browser-but-not-withi – Pouton Gerald May 13 '13 at 00:05