Shelaslifter commented on code in PR #4825:
URL: https://github.com/apache/fineract/pull/4825#discussion_r2258394669
##########
fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java:
##########
@@ -597,4 +599,15 @@ public void checkForUnsupportedParameters(final Type
typeOfMap, final String jso
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
requestDataParameters);
}
+ public String getClientIp() {
+ ServletRequestAttributes attrs = (ServletRequestAttributes)
RequestContextHolder.getRequestAttributes();
+ String clientIp = "";
+ if (attrs != null) {
+ Object ipAttr = attrs.getRequest().getAttribute("IP");
+ if (ipAttr != null) {
+ clientIp = ipAttr.toString();
+ }
+ }
+ return clientIp;
Review Comment:
It was implemented as a filter because it is considered an optional value.
This allows the system user to decide whether or not they want to capture the
IP address.
If it were implemented as a Utils class, the IP capture would be executed
automatically at all times, without the possibility of skipping it.
Additionally, we believe it is not necessary to create an additional class
solely for this purpose, as it would require more development effort for a
functionality that can remain optional more easily through a filter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]