PATCH and all of the other HTTP methods can be implemented right now via
the service() method.

Known registered HTTP methods -
https://www.iana.org/assignments/http-methods/http-methods.xhtml

This will work all the way back to at least Servlet 2.1, and you can
support any HTTP method with this general technique.

public class ServiceMethodServlet extends HttpServlet
{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse
resp) throws ServletException, IOException
    {
        if (req.getMethod().equalsIgnoreCase("PATCH"))
            doService(req, resp);
        else
            super.service(req, resp); // do default http-request-method to
do<HttpMethod>(req,resp) mappings.
    }

    protected void doService(HttpServletRequest req, HttpServletResponse
resp) throws ServletException, IOException
    {
    }
}


Joakim Erdfelt / [email protected]


On Wed, Mar 6, 2024 at 7:21 AM Gary Gregory via jetty-users <
[email protected]> wrote:

> Hi all,
>
> Do you have a guess as to when PATCH support will be available to
> servlets? My poking around suggests this will be in Jetty 12.1 through the
> Servlet 6.1 jar.
>
> Thank you all for Jetty!
> Gary
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to