Get user host ip address

Hello everyone,

I’m new in camunda.

I Need to get the user host’s ip address to call a distributed client process (trough a ws call).

Is there a way to get this information from a camunda task?

Thanks

@Alessandro_Palumbo this feature is not available, but you can intercept the HttpServletRequest and capture the client address.

private Map<String, String> getRequestHeadersInMap(HttpServletRequest request) {

    Map<String, String> result = new HashMap<>();

    Enumeration headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String key = (String) headerNames.nextElement();
        String value = request.getHeader(key);
        result.put(key, value);
    }

    return result;
}

(or) try this one:

String ipAddress = request.getHeader("X-FORWARDED-FOR");  
if (ipAddress == null) {  
    ipAddress = request.getRemoteAddr();  
}

Thanks you for the answer. But, how can i intercept the httprequest in camunda?

Cool, so i can use all the spring boot features. Thank you very much!

sorry, but it’s somethink i’m missing:

I had the camunda installation and add my JavaDelegate classes with a war created with the maven archetype servlet-war.
to add the interceptor i need to create another maven archetype implementation?

can you suggest me some guide?

and, it’s possible add the retrieved ip address in a process variable?

thank you