Java: Google App Engine "HTTP method POST is not supported by this URL" error
I just started playing with Google App Engine and Java. I've used Servlets in the past and I understand how they work. I'm trying to make a servlet to POST
to, but it's not going over very well.
Here's my 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. I've double and triple checked the DD (web.xml) file to make sure I have the url mappings correct. I can't find anything online specifically about th开发者_运维技巧is. I figure I am over looking something quite simple.
Here's my 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. I can't believe I over looked it so many times.
精彩评论