app.yaml url映射问题
app.yaml
application: cloudymovie
version: 1
runtime: java
welcome_files:
- test.jsp
handlers:
- url: /test/*
- servlet: com.test.TestLexerServlet
- name: testlexer
test.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
</head>
<body>
<form action="/test/" method="get">
<input type="submit" value="Go">
</form>
</body>
</html>
然后当我按下按钮时
HTTP ERROR 404
Problem accessing /test/. Reason:
NOT_FOUND
Powered by Jetty://
,我会查看自动生成的 web.xml 我发现
<servlet-mapping>
<servlet-name>com.test.TestLexerServlet</servlet-name>
<url-pattern>null</url-pattern>
</servlet-mapping>
url-pattern 不应该为 null
我是 GAE 新手。 感谢您的任何建议。
app.yaml
application: cloudymovie
version: 1
runtime: java
welcome_files:
- test.jsp
handlers:
- url: /test/*
- servlet: com.test.TestLexerServlet
- name: testlexer
test.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
</head>
<body>
<form action="/test/" method="get">
<input type="submit" value="Go">
</form>
</body>
</html>
and then when i press button
HTTP ERROR 404
Problem accessing /test/. Reason:
NOT_FOUND
Powered by Jetty://
and i take a look in the auto-generated web.xml
i found that
<servlet-mapping>
<servlet-name>com.test.TestLexerServlet</servlet-name>
<url-pattern>null</url-pattern>
</servlet-mapping>
url-pattern should not be null
I'm new in GAE.
Thanks for any advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
/test/*
将匹配“/test”、“/test/”、“/test//”等 - 可能不是您想要的。尝试使用/test/.*
代替。不过,问题的根本原因是您的 YAML 标记无效。而不是这样:
它应该看起来像这样:
/test/*
will match '/test', '/test/', '/test//', etc - probably not what you intended. Try/test/.*
instead.The root cause of your problem, though, is that your YAML markup isn't valid. Instead of this:
it should look like this: