英文:
Route dynamic URLs to static files in App Engine Java
问题
我有一个Java App Engine应用程序,想要将mydomain.com/i/<anything>
路由到i.html
。例如:
mydomain.com/i/12345 --> i.html
mydomain.com/i/abcde --> i.html
在Python的app.yaml和Go的app.yaml中,似乎可以通过以下方式实现:
handlers:
- url: /i/(.*)
static_files: i.html
但是在Java的app.yaml中,并没有提到将处理程序映射到静态文件的方法。相反,有一个单独的静态文件和资源文件部分,不能进行URL映射,而在handlers
中映射URL的选项只能是servlet
、jsp
或filter
。如果我尝试在Java的app.yaml中映射到static_files
,会出现Unable to find property 'static_files'
错误。
关键在于,我想要将一个URL映射到作为静态文件提供的静态文件。为什么这只能在Python和Go中实现,而在Java中却不能呢?
英文:
I have a Java App Engine app and want to route mydomain.com/i/<anything>
to i.html
. For example:
mydomain.com/i/12345 --> i.html
mydomain.com/i/abcde --> i.html
This looks like it is possible to do in app.yaml for Python and app.yaml for Go with something like:
handlers:
- url: /i/(.*)
static_files: i.html
but this handler mapping to static files is NOT mentioned in app.yaml for Java. Instead, there is a separate Static files and resource files section that cannot do url mappings, and the only options to map a url in handlers
is to a servlet
, jsp
, or filter
. If I try to map to static_files
in a Java app.yaml, I get an Unable to find property 'static_files'
error.
The key here is that I want to map a url to a static file that is served as a static file. Why would this be only possible to do in Python and Go, and not in Java?
答案1
得分: 1
我不使用Java版本,但是看起来appengine-web.xml
的作用与Go/Python中的app.yaml
相同。
英文:
I dont use the java version but it looks like the appengine-web.xml
serves the same function as the app.yaml in go / python?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论