3

I'm working on an implementation of the JSON Patch spec using Java servlets on the Bitnami Tomcat Stack. On the servlet end I'm handling the HTTP PATCH method by overriding HttpServlet.service() method like so:

@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
    if (request.getMethod().equals("PATCH"))
        doPatch(request, response);
    else
        super.service(request, response);
}

The problem is that, when I try to send an HTTP PATCH request to Tomcat, Apache httpd rejects it with a 501 "Method Not Implemented".

Is there a way to make Apache httpd stop doing this?

Community
  • 1
  • 1
gilbertpilz
  • 1,708
  • 20
  • 30
  • Wnat is causing your problem? Apache HTTPd or Apache Tomcat? – Michael-O Dec 21 '12 at 17:56
  • HTTPd. It's rejecting the HTTP PATCH request. I know this because I've directed the same request directly to Tomcat and reached my servlet code. I'm unwilling to take HTTPd out of the loop forever, though, so I'd like to know if there is a way I can configure it to forward the PATCH request along. – gilbertpilz Dec 21 '12 at 18:33
  • Did you already check your webservers config? Logfiles? – Michael-O Dec 21 '12 at 18:58
  • Why are Tomcat and Apache listening on the same ports? – Thorn G Dec 21 '12 at 20:15
  • Tomcat and Apache are not listening on the same port. HTTPd is listening on 80 and forwarding requests to Tomcat using the AJP connector on port 8009. – gilbertpilz Dec 26 '12 at 17:00
  • @Michael-O error_log contains the following entry: `[Mon Jan 14 21:04:15 2013] [error] ajp_marshal_into_msgb - No such method PATCH [Mon Jan 14 21:04:15 2013] [error] ajp_send_header: ajp_marshal_into_msgb failed` – gilbertpilz Jan 14 '13 at 21:15
  • @gilbertpilz, you should file a bug with AJP as it obviously not supports the `PATCH` method. – Michael-O Jan 15 '13 at 08:44

1 Answers1

6

AJP13 does not yet support HTTP PATCH (AJPv13a). Connect your Apache Web Server and Tomcat using HTTP if you would like to use PATCH.

brainfrozen
  • 253
  • 1
  • 5
  • 13
  • 2
    The AJP protocol supports PATCH. This is documented in [this bug report](https://issues.apache.org/bugzilla/show_bug.cgi?id=56884). However, mod_proxy may not support PATCH over AJP. Also it appears that [this was fixed in Apache2 2.4.3](https://issues.apache.org/bugzilla/show_bug.cgi?id=54416). Another option may be mod_jk. – Larry Chu Dec 30 '14 at 23:22
  • Correction - It was fixed in 2.4.4. – Larry Chu Dec 30 '14 at 23:52