Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EE8/9 DefaultServlet.doPost() doesn't behave like Jetty 10/11 #11299

Closed
lorban opened this issue Jan 22, 2024 · 2 comments · Fixed by #11300
Closed

EE8/9 DefaultServlet.doPost() doesn't behave like Jetty 10/11 #11299

lorban opened this issue Jan 22, 2024 · 2 comments · Fixed by #11300
Assignees
Labels
Bug For general bugs on Jetty side Sponsored This issue affects a user with a commercial support agreement
Milestone

Comments

@lorban
Copy link
Contributor

lorban commented Jan 22, 2024

Jetty version(s)
12

Jetty Environment
EE 8/9

Description
In Jetty 10/11 DefaultServlet.doPost() does what doGet() does:

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
{
    doGet(request, response);
}

While in Jetty 12 EE 8/9 it returns an error 405:

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
{
    response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
}

The pre-existing behavior should be restored for backward compatibility.

@lorban lorban added Bug For general bugs on Jetty side Sponsored This issue affects a user with a commercial support agreement labels Jan 22, 2024
@lorban lorban added this to the 12.0.x milestone Jan 22, 2024
@lorban lorban self-assigned this Jan 22, 2024
lorban added a commit that referenced this issue Jan 22, 2024
…behavior

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@joakime
Copy link
Contributor

joakime commented Jan 22, 2024

The DefaultServlet needs to support GET, HEAD, and OPTIONS properly for sure.

Should it support POST too? (we used to just redirect doPost to doGet, Tomcat does it too)

Should it support any other methods? (PUT is supported by Tomcat, but that adds a whole read-only aspect, and would be confusing with our CombinedResource)

@lorban
Copy link
Contributor Author

lorban commented Jan 23, 2024

@joakime Since we're talking about EE8/9, my mental model is that we should behave exactly how Jetty 10/11 do, even if that's odd or questionable. In this case, Jetty 10/11 treat POST exactly like GET but PUTs are rejected, so IMHO this is what EE8/9 should do.

But your question remains valid for EE10, and in that case responding to POST with 405 is IMHO the right thing to do.

lorban added a commit that referenced this issue Jan 24, 2024
#11300)

#11299 restore DefaultServlet.doPost to the previous major releases' behavior

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Sponsored This issue affects a user with a commercial support agreement
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants