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

Sample code of "Jackson JSON Views support" is wrong ? [SPR-12994] #17586

Closed
spring-issuemaster opened this issue May 6, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented May 6, 2015

Kazuki Shimizu opened SPR-12994 and commented

In "Jackson JSON Views support" of "22.10.1 RestTemplate", sample code is wrong ?

  • JacksonSerializationValue -> MappingJacksonValue ?

Currently:

JacksonSerializationValue jsv = new JacksonSerializationValue(new User("eric", "7!jd#h23"),
    User.WithoutPasswordView.class);
HttpEntity<JacksonSerializationValue> entity = new HttpEntity<JacksonSerializationValue>(jsv);
String s = template.postForObject("http://example.com/user", entity, String.class);

Modification candidate :

MappingJacksonValue mjv = new MappingJacksonValue(new User("eric", "7!jd#h23"));
mjv.setSerializationView(User.WithoutPasswordView.class);
HttpEntity<MappingJacksonValue> entity = new HttpEntity<MappingJacksonValue>(mjv);
String s = template.postForObject("http://example.com/user", entity, String.class);

How do think ?


Affects: 4.1.6

Referenced from: commits 581cf3a, 2b21867

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 7, 2015

Sébastien Deleuze commented

This is now fixed in master and 4.1.x, thanks for reporting this error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.