Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested pojo & extending another POJO #87

Open
seunghx opened this issue Feb 19, 2020 · 1 comment
Open

Nested pojo & extending another POJO #87

seunghx opened this issue Feb 19, 2020 · 1 comment

Comments

@seunghx
Copy link

seunghx commented Feb 19, 2020

public static class Temp {
    private String name;
    private int age;
    private List<String> list;
    private Nested nested;
    private Map<String, List<String>> map;

   public Temp(){}

    public Temp(String name, int age, List<String> list, Nested nested,
        Map<String, List<String>> map) {
      this.name = name;
      this.age = age;
      this.list = list;
      this.nested = nested;
      this.map = map;
    }
   // Getter, Setter toString ...
}
public class Nested {
  private String title;

  public Nested() {
  }
// Getter Setter etc ...
}

`

im testing feign for http client of my spring boot project

when i use api like below with POJO parameter typed Temp

@PostMapping(value = "/temp",consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
  String formEncodedPost(Temp temp);

It seemd that FormEncoder(accurately PojoUtil) just set Nested.toString() for 'title' property of Nested class

so when i log Nested instance

logger say "Nested{title='Nested{title='title 1'}"

this is debugging log for client side

 [POST /form HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: */*
User-Agent: Java/1.8.0_222
Host: localhost:8080
Connection: keep-alive
Content-Length: 77
name=tempName&list=1&list=2&list=3&nested=**Nested%7Btitle%3Dtitle+1%7D**&age=100]

and
below is server side log
`
Start processing with input [name=tempName&list=1&list=2&list=3&nested=Nested%7Btitle%3Dtitle+1%7D&age=100]

`

and nest Map or HashMap or LinkedMultiValueMap not works well. (server said, can not convert String to map)

this is bug? or intended action?

And maybe extending another pojo not works -> feign encode data to body only properties in child POJO

@seunghx seunghx changed the title Nested pojo Nested pojo & extending another POJO Feb 24, 2020
@slawekjaranowski
Copy link

can be connected with: #95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants