serve static image along side java google-endpoint

2019-03-05 19:52发布

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

1条回答
相关推荐>>
2楼-- · 2019-03-05 20:28

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.

查看更多
登录 后发表回答