Hello,
For some reasons I need to know the IP Address of the Customer in the KKCustomEng. I couldn't find any method that gives me the IP Address so I thought it would be best to set it from an Action (BaseAction.java).
It seems that getKKAppEng(HttpServletRequest) is the method that gets called nearly everytime an Action is performed, so I customized it a bit to have access to the IP Address from KKCustomEng.
1. I made a new dataelement in KKCustomEng named "String remoteAddr"
2. I modified BaseAction.getKKAppEng() this way:
First it seemed to work, but I never had the IP Adress available in KKCustomEng. Does kkAppEng.getEng() always return a new KKEngIf-object?
If yes: Is there another Way to pass the Ip Address to KKCustomEng?
Thanks in advance
For some reasons I need to know the IP Address of the Customer in the KKCustomEng. I couldn't find any method that gives me the IP Address so I thought it would be best to set it from an Action (BaseAction.java).
It seems that getKKAppEng(HttpServletRequest) is the method that gets called nearly everytime an Action is performed, so I customized it a bit to have access to the IP Address from KKCustomEng.
1. I made a new dataelement in KKCustomEng named "String remoteAddr"
2. I modified BaseAction.getKKAppEng() this way:
Code Select
...
kkAppEng.setPageTitle(getCatMessage(request, "seo.default.title"));
kkAppEng.setMetaDescription(getCatMessage(request, "seo.default.meta.description"));
kkAppEng.setMetaKeywords(getCatMessage(request, "seo.default.meta.keywords"));
/* CUSTOMIZATION */
try {
String ip = request.getRemoteAddr();
if(kkAppEng.getEng() instanceof KKCustomEng && ip != null) {
((KKCustomEng)kkAppEng.getEng()).setRemoteAddr(ip);
}
}
catch(Exception e) {
mylog.debug("Error " + e.getMessage());
}
/* CUSTOMIZATION */
return kkAppEng;
}
First it seemed to work, but I never had the IP Adress available in KKCustomEng. Does kkAppEng.getEng() always return a new KKEngIf-object?
If yes: Is there another Way to pass the Ip Address to KKCustomEng?
Thanks in advance