[英]Java: Google App Engine “HTTP method POST is not supported by this URL” error
I just started playing with Google App Engine and Java. 我刚开始玩Google App Engine和Java。 I've used Servlets in the past and I understand how they work.
我过去使用过Servlets,我理解它们是如何工作的。 I'm trying to make a servlet to
POST
to, but it's not going over very well. 我正在尝试将一个servlet发布到
POST
,但它并没有很好地完成。
Here's my Servlet: 这是我的Servlet:
public class CreateUser extends HttpServlet
{
private static final long serialVersionUID = 1L;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
...
}
}
Here's what I get when I post to this from a form: 这是我从表单发布到这里时得到的结果:
HTTP ERROR 405
Problem accessing /user/create. Reason:
HTTP method POST is not supported by this URL
I don't understand why I'm getting this when I clearly have implemented doPost. 当我明确实施doPost时,我不明白为什么我会这样做。 I've double and triple checked the DD (web.xml) file to make sure I have the url mappings correct.
我已经对DD(web.xml)文件进行了两次和三次检查,以确保我的url映射是正确的。 I can't find anything online specifically about this.
我在网上找不到任何关于此的内容。 I figure I am over looking something quite simple.
我想我看起来很简单。
Here's my web.xml: 这是我的web.xml:
<web-app...>
...
<servlet>
<servlet-name>CreateUser</servlet-name>
<servlet-class>com.joelj.music.api.CreateUser</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Index</servlet-name>
<url-pattern>/user/create</url-pattern>
</servlet-mapping>
</web-app>
Thanks. 谢谢。
I feel really stupid. 我觉得真的很蠢。 After looking at the code I just posted I realized that the entry was pointed to Index.
看完我刚刚发布的代码后,我意识到该条目指向了Index。 I can't believe I over looked it so many times.
我不敢相信我看了这么多次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.