question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow to customize encoding process of path params

See original GitHub issue

Currently Encoder is applied only for @RequestBody params. What about @RequestParam?

I know this is special case but we have lot of working legacy code. For current solution this objects are serialized using Jackson (we use @JsonValue) but Feign uses simple toString().

Possible solutions:

  • invoke Encoder for all parameter types
  • use Jackson to serialize object

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
spencergibbcommented, Jan 31, 2017

This is not the forum to discuss FeignFormatterRegistrar and other spring cloud Netflix things

1reaction
rmaciej1983commented, Oct 27, 2016

If you use @FeignClient and Spring Cloud Netflix you can use org.springframework.cloud.netflix.feign.FeignFormatterRegistrar. You should create a bean in client’s configuration:

@Bean
public FeignFormatterRegistrar localDateFeignFormatterRegistrar() {
     return new FeignFormatterRegistrar() {
         @Override
         public void registerFormatters(FormatterRegistry formatterRegistry) {
            //Here should be some code.
          }
     };
}

In registerFormatters() method you have access to object of FormatterRegistry. If you look inside the FormatterRegistry class, you will see a method:

void addFormatterForFieldType(Class<?> fieldType, Printer<?> printer, Parser<?> parser);

This is a method that will let you to associate specific class with a printer (for building a string from an object) and parser (for building an object from a string).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to force URIBuilder.path(...) to encode parameters like ...
When a parameter contains the character "%" followed by two characters that together form an URL-encoded character, the "%" is not encoded as...
Read more >
URL Encoding Path and Query Parameters
If path or query parameters contain characters that are either reserved or potentially unsafe when used in URLs, those characters must be URL...
Read more >
Path Parameters - FastAPI
You can declare path "parameters" or "variables" with the same syntax used by Python format strings: from fastapi import FastAPI app = FastAPI() ......
Read more >
encodeURIComponent() - JavaScript - MDN Web Docs
The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape ...
Read more >
Chapter 14. @Encoded and encoding - JBoss.org
JAX-RS allows you to get encoded or decoded @*Params and specify path definitions and parameter names using encoded or decoded strings. The @javax.ws.rs....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found