<div dir="ltr"><div class="gmail_default" style="font-family:&quot;courier new&quot;,monospace"><p class="MsoNormal"><span lang="EN-GB">Hi,<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">we are
implementing a proxy solution based on Wildfly/Undertow.<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">There are a
couple of custom handler configured in a row. Two of the handlers are deal with
the incoming request – message validator and message log.<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">The message
validator use the solution form this class to read the incoming request:<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">core/src/main/java/io/undertow/server/handlers/RequestBufferingHandler.java<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">The message
log based on conduits and logs on the exchange complete event.<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">It works
almost perfectly however the first request fails with this when the log handler
registers the conduit:<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">2016-09-21 10:05:02,034 INFO  [hu.telekom.lwi.plugin.log.LwiLogHandler]
(default task-1) [lwiId-lpx1474445101966] LwiLogHandler &gt; start
request/response log handling (FULL)...<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">2016-09-21 10:05:02,039 ERROR [io.undertow.request]
(default task-1) UT005071: Undertow request failed HttpServerExchange{ POST
/lwi/cnr/getMsisdn request {X-MT-UserId=[pzs], SOAPAction=[&quot;&quot;], X-MT-CorrelationId=[123],
Accept-Encoding=[gzip,deflate], X-Lwi-RequestId=[lwiId-lpx1474445101966],
User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)], X-SSL-Client-CN=[lwitester1], X-MT-RequestId=[12345], Content-Type=[text/xml;charset=UTF-8],
Content-Length=[798], Host=[localhost:444]} response {}}:
java.lang.IllegalStateException: UT000005: getRequestChannel() has already been
called<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
io.undertow.server.HttpServerExchange.addRequestWrapper(HttpServerExchange.java:1406)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
hu.telekom.lwi.plugin.log.LwiConduitWrapper.applyConduits(LwiConduitWrapper.java:50)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
hu.telekom.lwi.plugin.log.LwiLogHandler.handleRequest(LwiLogHandler.java:38)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
hu.telekom.lwi.plugin.validation.ValidationHandler.handleRequest(ValidationHandler.java:78)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;">       at
java.lang.Thread.run(Thread.java:745)<span></span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;"><span> </span></span></p>

<p class="MsoNormal"><span style="font-size:9pt;font-family:&quot;courier new&quot;"><span> </span></span></p>

<p class="MsoNormal"><span lang="EN-GB">After the
first call everything work perfectly there is no error, however it is true that
the exchange.getRequestChannel() was called in the message validation handler.<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">Is it any
work around for this?<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">Regards, Zsolt<span></span></span></p></div></div>