Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] PATCH support in 12.1?

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 / joakim@xxxxxxxxxxx


On Wed, Mar 6, 2024 at 7:21 AM Gary Gregory via jetty-users <jetty-users@xxxxxxxxxxx> 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
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top