A patch for org.mule.providers.http.HttpMessageReceiver is attached. It adds the instance variable remoteClientAddress. The value comes from socket.getRemoteSocketAddress ().toString (). After a MuleMessage is instantiated, and before routeMessage() is invoked, the remote client address is stored as the property named MULE_REMOTE_CLIENT_ADDRESS of the MuleMessage.
This allows us to see the http client address in an exception stacktrace, for example:
jvm 1 | at org.mule.providers.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:187)
jvm 1 | at org.mule.providers.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155)
jvm 1 | at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
jvm 1 | at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:9
87)
jvm 1 | at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
528)
jvm 1 | at java.lang.Thread.run(Unknown Source)
jvm 1 |
jvm 1 | ********************************************************************************
jvm 1 |
jvm 1 | 14:18:30,587 ERROR oadExceptionStrategy [eiver.2]: Message being processed is: org.mule.providers.http.HttpMe
ssageAdapter/org.mule.providers.http.HttpMessageAdapter@6a435f{id=685f29ed-9be7-11dc-b791-95c48a029aff, payload=[B, corr
elationId=null, correlationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null, properties={
jvm 1 | MULE_REMOTE_SYNC=true
jvm 1 | http.version=HTTP/1.1
jvm 1 | Authorization=Basic YW5vbjphbm9ucGFzc3dk
jvm 1 | User-Agent=curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8e zlib/1.2.3 libssh2/0.15-CVS
jvm 1 | MULE_REMOTE_CLIENT_ADDRESS=/127.0.0.1:4459
jvm 1 | Accept=/
jvm 1 | MULE_ORIGINATING_ENDPOINT=OperationTypeCheckerSyncEndpoint
jvm 1 | Content-Length=38
jvm 1 | Content-Type=application/x-www-form-urlencoded
jvm 1 | http.method=POST
jvm 1 | http.request=/OperationTypeChecker
jvm 1 | Host=localhost:7000
jvm 1 | }}
A patch for org.mule.providers.http.HttpMessageReceiver is attached. It adds the instance variable remoteClientAddress. The value comes from socket.getRemoteSocketAddress ().toString (). After a MuleMessage is instantiated, and before routeMessage() is invoked, the remote client address is stored as the property named MULE_REMOTE_CLIENT_ADDRESS of the MuleMessage.
This allows us to see the http client address in an exception stacktrace, for example:
jvm 1 | at org.mule.providers.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:187)
jvm 1 | at org.mule.providers.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155)
jvm 1 | at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
jvm 1 | at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:9
87)
jvm 1 | at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
528)
jvm 1 | at java.lang.Thread.run(Unknown Source)
jvm 1 |
jvm 1 | ********************************************************************************
jvm 1 |
jvm 1 | 14:18:30,587 ERROR oadExceptionStrategy [eiver.2]: Message being processed is: org.mule.providers.http.HttpMe
ssageAdapter/org.mule.providers.http.HttpMessageAdapter@6a435f{id=685f29ed-9be7-11dc-b791-95c48a029aff, payload=[B, corr
elationId=null, correlationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null, properties={
jvm 1 | MULE_REMOTE_SYNC=true
jvm 1 | http.version=HTTP/1.1
jvm 1 | Authorization=Basic YW5vbjphbm9ucGFzc3dk
jvm 1 | User-Agent=curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8e zlib/1.2.3 libssh2/0.15-CVS
jvm 1 | MULE_REMOTE_CLIENT_ADDRESS=/127.0.0.1:4459
jvm 1 | Accept=/
jvm 1 | MULE_ORIGINATING_ENDPOINT=OperationTypeCheckerSyncEndpoint
jvm 1 | Content-Length=38
jvm 1 | Content-Type=application/x-www-form-urlencoded
jvm 1 | http.method=POST
jvm 1 | http.request=/OperationTypeChecker
jvm 1 | Host=localhost:7000
jvm 1 | }}