Alternative for httpclient which support PATCH or use a tunnel service on the client

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Alternative for httpclient which support PATCH or use a tunnel service on the client

Ralph van Etten
Hi,

I have a restlet client which uses the PATCH method and I am using the ClientResource.wrap() to get a proxy for the resource.

When using the default HTTP client it will complain about HttpUrlConnection not supporting PATCH. 
I can use the org.restlet.ext.httpclient extension which does support PATCH but this is deprecated.

So my questions are:

1. is there an alternative for org.restlet.ext.httpclient which supports PATCH
2. can I make use of the TunnelService on the client so PATCH methods are send as POSTs with an extra query argument containing the actual method.


Thanks,

Ralph.

To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Alternative for httpclient which support PATCH or use a tunnel service on the client

Thierry Templier-3
Hi,

Here are my answers to your questions:

1. The extension httpclient is deprecated (and will be removed in version 3.0) in favor of the extension jetty that provides a client connector. It supports PATCH requests...

2. Sure, you can leverage the tunnel service if you want to simulate patch requests using post ones, as described below:

public class RestletApplication extends Application {
public RestletApplication() {
        getTunnelService().setEnabled(true);
  getTunnelService().setMethodTunnel(true);
  getTunnelService().setMethodParameter("method");
  }
    @Override
    public Restlet createInboundRoot() {
        Router router = new Router(getContext());
        router.attach("/test", MyServerResource.class);
        return router;
    }
}

In this case, you will be able to execute requests like that: POST http://localhost:8182/test?method=PATCH. An PATCH-annotated method will be called in this case instead of a POST one.

Hope it answered your questions.
Thierry


2015-10-12 17:27 GMT+02:00 ralph <[hidden email]>:
Hi,

I have a restlet client which uses the PATCH method and I am using the ClientResource.wrap() to get a proxy for the resource.

When using the default HTTP client it will complain about HttpUrlConnection not supporting PATCH. 
I can use the org.restlet.ext.httpclient extension which does support PATCH but this is deprecated.

So my questions are:

1. is there an alternative for org.restlet.ext.httpclient which supports PATCH
2. can I make use of the TunnelService on the client so PATCH methods are send as POSTs with an extra query argument containing the actual method.


Thanks,

Ralph.



--
Best,
Thierry
--
Thierry Templier, Lead Architect


Restlet SAS, 6 rue Rose Dieng-Kuntz • 44300 Nantes  France

To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Loading...