serve static image along side java google-endpoint api

自作多情 提交于 2019-12-20 06:34:11

问题


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:


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.



来源:https://stackoverflow.com/questions/16510724/serve-static-image-along-side-java-google-endpoint-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!