[undertow-dev] Undertow server doesn't support PATCH

Stuart Douglas sdouglas at redhat.com
Mon Oct 3 20:50:07 EDT 2016


I have added it:

https://github.com/undertow-io/undertow/commit/a31cd171816f4d70006a64f077fc34ba9c888f4b

Stuart

On Tue, Oct 4, 2016 at 11:47 AM, Steve Hu <stevehu at gmail.com> wrote:
> Hi Miere,
>
> Thanks for the answer. I know I can create a patch handler myself but I am
> curious on why this is not implemented as a built-in method like others.
> Also, I have problem to use it if PATCH is not in Methods.java as I am using
> swagger-codegen to scaffold the server stubs from swagger specification the
> first time.
>
> Here is the code and as you can see they are following the same pattern for
> the http method. There might be a good reason that PATCH is not implemented,
> but it would be really helpful to add this HttpString into the Methods
> class.
>
> Regards,
>
> Steve
>
>
> .add(Methods.PATCH, "/v2/fake", new HttpHandler() {
>             public void handleRequest(HttpServerExchange exchange) throws
> Exception {
>                 exchange.getResponseSender().send("testClientModel");
>             }
>         })
>
>
> .add(Methods.POST, "/v2/fake", new HttpHandler() {
>             public void handleRequest(HttpServerExchange exchange) throws
> Exception {
>                 exchange.getResponseSender().send("testEndpointParameters");
>             }
>         })
>
>
> .add(Methods.GET, "/v2/fake", new HttpHandler() {
>             public void handleRequest(HttpServerExchange exchange) throws
> Exception {
>                 exchange.getResponseSender().send("testEnumParameters");
>             }
>
>         })
>
> On Mon, Oct 3, 2016 at 4:29 PM, Miere Teixeira <miere.teixeira at gmail.com>
> wrote:
>>
>> Hi Steve Hu,
>>
>> Most of Undertow built-in Handlers expects a HttpString to identify which
>> HTTP Method you intent to handle. Indeed, it does not have a PATCH but I do
>> believe you can easily create your own HttpString with something like the
>> sample code bellow:
>>
>> public static final HttpString PATCH = new HttpString("PATCH");
>>
>> Also, you can create your own handler, if none of available Handlers fit
>> your needs. It is quite easy... Feel free to e-mail me if you need some help
>> with it.
>>
>> Regards,
>>
>> On Mon, Oct 3, 2016 at 9:21 AM Steve Hu <stevehu at gmail.com> wrote:
>>>
>>> Hi Tomaz,
>>>
>>> Thanks for the quick response. The reason I said undertow doesn't support
>>> PATCH is based on this file.
>>>
>>> https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/util/Methods.java
>>>
>>> As you can see there is no patch method available and I even searched the
>>> entire source tree with patch keyword.
>>>
>>> Steve
>>>
>>> On Mon, Oct 3, 2016 at 7:41 AM, Tomaž Cerar <tomaz.cerar at gmail.com>
>>> wrote:
>>>>
>>>> Undertow as server supports all http methods.
>>>> It is up to handlers in handler chain that might choose not to support
>>>> some methods.
>>>> I would look into your handler chain configuration to see which one is
>>>> not handling PATCH properly.
>>>>
>>>> --
>>>> tomaz
>>>>
>>>> On Sun, Oct 2, 2016 at 9:50 PM, Steve Hu <stevehu at gmail.com> wrote:
>>>>>
>>>>> I am building a REST API framework on top of undertow core to support
>>>>> design driven implementation from Open API (Swagger) specifications for
>>>>> security and validation during runtime. From swagger-codegen result, I found
>>>>> that undertow doesn't support http method PATCH. Is there a reason it is not
>>>>> supported? or any workaround? Thanks.
>>>>>
>>>>> https://github.com/networknt/undertow-server
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> undertow-dev mailing list
>>>>> undertow-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> undertow-dev mailing list
>>> undertow-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>
>
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev



More information about the undertow-dev mailing list