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

Inject IP address via Jackson #56

Merged
merged 2 commits into from
Jan 12, 2016
Merged

Conversation

phraktle
Copy link
Contributor

This avoids mutating the JSON tree objects. See also maxmind/MaxMind-DB-Reader-java#13

This avoids mutating the JSON tree objects.
Made it consistent with the behavior of DatabaseReader, which also
injects the ip address / traits.
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
false);
mapper.configure(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS, false);
String ip = ipAddress == null ? null : ipAddress.getHostAddress();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The web service will always return an IP address on a successful request. We should just use that value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a value in the response JSON, it will override the injection.

oschwald added a commit that referenced this pull request Jan 12, 2016
Inject IP address via Jackson
@oschwald oschwald merged commit 4f47e0c into maxmind:master Jan 12, 2016
@oschwald
Copy link
Member

Thanks yet again!

@phraktle phraktle deleted the inject-ip branch January 12, 2016 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants