spring-cloud-netflix icon indicating copy to clipboard operation
spring-cloud-netflix copied to clipboard

Missing HTTP PATCH request method in Zuul RibbonRoutingFilter

Open scheeles opened this issue 11 years ago • 28 comments

Do you see any possibility that the RibbonRoutingFilter will support HTTP PATCH.

The problem is, that the enum Verb from com.netflix.client.http.HttpRequest don't support HTTP PATCH.

If it is not possible, perhaps it should be documented, which HTTP Verbs Ribbon & Zuul supports.

This issues is related to #307.

scheeles avatar Jun 28 '15 16:06 scheeles

This is going to be a problem for me as well, since I'm using Spring Data REST, and use of the PATCH method is the documented way to update resources without having to supply a fully populated object.

zampettim avatar Jun 30 '15 13:06 zampettim

This is coursing trouble to me too when one service want to update something in other service. Any way around this ?

hrandika avatar Jul 01 '15 09:07 hrandika

We use ApacheHTTP as the client for ribbon. Dependencies need to be pushed.

 <dependency>
      <groupId>com.netflix.feign</groupId>
      <artifactId>feign-httpclient</artifactId>
      <version>8.3.0</version>
    </dependency>

now you should be able to do sthg like. Don't use okhttp if you also want to use newrelic. No introspection there.

 @Bean
 public Client feignRibbonClient() {
        return RibbonClient.builder().delegate(new ApacheHttpClient()).lbClientFactory(cachingLBClientFactory()).build();
 }

schoberwirt avatar Jul 15 '15 09:07 schoberwirt

@schoberwirt Where is the cachingLBClientFactory() coming from?

zampettim avatar Jul 15 '15 14:07 zampettim

Ok, here is what I had to do to get a FeignClient implemenation to work. I haven't tested in a Zuul case yet, but it should be similar. And that is next on my plate.

I had to up-rev the following dependencies. Updated com.netflix.feign.{feign-core,feign-ribbon,feign-slf4j,feign-httpclient} to 8.5.0 I also had to add feign-httpclient to the dependencies. That then forced the need to update org.apache.httpcomponents to account for missing methods. So updated org.apache.httpcomponents.httpclient to 4.5 and updated apache.httpcomponents.httpcore to 4.4.1 (under the assumption that httpclient will work best with the latest httpcore.

Then I had to add the following to my Spring Application classes

@Bean
public Client feignRibbonClient() {
    return RibbonClient.builder().delegate(new ApacheHttpClient()).build();
}

I let the RibbonClient use the default lbClientFactory instead of injecting my own. That allowed me to configure Feign to use Apache HTTP Client as the implementation, and thus get PATCH support.

zampettim avatar Jul 15 '15 14:07 zampettim

Feign has been updated to 8.6.0, see #436

spencergibb avatar Jul 15 '15 18:07 spencergibb

how would you all feel if com.netflix.feign:feign-httpclient was on the classpath to auto-configure its use, similar to how @zampettim has shown?

spencergibb avatar Jul 15 '15 18:07 spencergibb

@spencergibb that would be awesome. +1.

hrandika avatar Jul 15 '15 20:07 hrandika

See #442

spencergibb avatar Jul 15 '15 20:07 spencergibb

#443 is the beginning of allowing http client in zuul

spencergibb avatar Jul 16 '15 02:07 spencergibb

This all sounds great to me.

zampettim avatar Jul 16 '15 15:07 zampettim

@zampettim I have tried with Zuul still the patch method does not work.Also I use 8.6.0 version of feign from Brixton.BUILD-SNAPSHOT of spring cloud.

hrandika avatar Jul 16 '15 19:07 hrandika

@hrandika those things that @zampettim was showing relate only to feign, not to zuul. I'm in the middle of working on it in #443.

spencergibb avatar Jul 16 '15 19:07 spencergibb

inadvertently closed

spencergibb avatar Aug 21 '15 17:08 spencergibb

The groundwork has been laid in b494e1d.

spencergibb avatar Aug 21 '15 17:08 spencergibb

Is there any progress in implementing a concrete RibbonCommand/Factory which can finally handle PATCH requests? The lack of this blocks our project which heavily depends on spring cloud concepts like zuul enabled frontends and spring-data-rest enabled resource services. Otherwise i would implement it on my own but it is a bit difficult for me to understand what really happens there. There is a RibbonLoadbalancer in org.springframework.cloud.netflix.feign.ribbon which seems to be useful as client for the RibbonCommand. But unfortunately it has package visible implementations of RibbonRequest and RibbonResponse as it was meant to be used only by Feign i doubt. Should i create a new AbstractLoadBalancerAwareClient?

ChristianLohmann avatar Sep 09 '15 08:09 ChristianLohmann

There has been no progress.

spencergibb avatar Sep 09 '15 19:09 spencergibb

Is there any progress on this issue. what is a way around for this problem?

dinkarthakur avatar Jan 28 '16 14:01 dinkarthakur

@dinkarthakur The change is available in Brixton M4 or snapshot, and you enable it by adding the following to a @Configuration class:

@Bean
public RibbonCommandFactory ribbonCommandFactory(SpringClientFactory clientFactory) {
    return new HttpClientRibbonCommandFactory(clientFactory);
}

jordanjennings avatar Jan 28 '16 14:01 jordanjennings

Still not able to make PATCH request

dinkarthakur avatar Jan 28 '16 14:01 dinkarthakur