[ 
https://issues.apache.org/jira/browse/CXF-8909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Colm O hEigeartaigh resolved CXF-8909.
--------------------------------------
    Resolution: Not A Problem

Use the pattern converter meant for MDC values

> MDC variable ctx:HttpMethod  gives always POST even for GET requests if first 
> request is with POST
> --------------------------------------------------------------------------------------------------
>
>                 Key: CXF-8909
>                 URL: https://issues.apache.org/jira/browse/CXF-8909
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.5.3
>            Reporter: Sreenivas K
>            Priority: Minor
>
> I've configured Log4j2 pattern like this:
> <PatternLayout pattern="%d\{dd MMM yyyy HH:mm:ss,SSS } *${ctx:HttpMethod}* 
> %-5p [%t] %c\{2} - %m%n" />
> If my first request is {*}POST{*},  In logs i could see like this for *POST* 
> requests:
> *01 Aug 2023 11:57:50,414  _POST_ INFO  [http-nio-8081-exec-16] 
> IHelloWorld.REQ_IN - REQ_IN*
>     Address: http://localhost:8081/JavaFirstSpringSupport/services/HelloWorld
>     HttpMethod: POST
>     Content-Type: text/xml;charset=UTF-8
>     ExchangeId: afdb40b5-ed29-4eca-ac84-71264e3ff1a8
>     ServiceName: HelloWorld
>     PortName: HelloWorldHttpSoap11Endpoint
>     PortTypeName: IHelloWorld
>     Headers: \{SOAPAction="urn:getCountries", host=localhost:8081, 
> connection=Keep-Alive, content-type=text/xml;charset=UTF-8, 
> Content-Length=203, accept-encoding=gzip,deflate, 
> user-agent=Apache-HttpClient/4.5.5 (Java/12.0.1)}
>     Payload: <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:api="http://api.service.spring.demo/";>
>    
>   <soapenv:Header/>
>    
>   <soapenv:Body>
> <api:getCountries/>
>    </soapenv:Body>
> </soapenv:Envelope>
> *01 Aug 2023 11:57:50,475  _POST_ INFO  [http-nio-8081-exec-16] 
> IHelloWorld.RESP_OUT - RESP_OUT*
>     Address: http://localhost:8081/JavaFirstSpringSupport/services/HelloWorld
>     Content-Type: text/xml
>     ResponseCode: 200
>     ExchangeId: afdb40b5-ed29-4eca-ac84-71264e3ff1a8
>     ServiceName: HelloWorld
>     PortName: HelloWorldHttpSoap11Endpoint
>     PortTypeName: IHelloWorld
>     Headers: {}
>     Payload: <soap:Envelope 
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soap:Body>
>     <ns2:getCountriesResponse xmlns:ns2="http://api.service.spring.demo/";>
>       <return>US</return>
>       <return>UK</return>
>       <return>INDIA</return>
>     </ns2:getCountriesResponse>
>   </soap:Body>
> </soap:Envelope>
>  
> and all further requests, even for *GET* requests , its showing like this:
> *01 Aug 2023 11:58:05,251  _{color:#de350b}POST{color}_ INFO  
> [http-nio-8081-exec-13] IHelloWorld.REQ_IN - REQ_IN*
>     Address: http://localhost:8081/JavaFirstSpringSupport/services/HelloWorld
>     {color:#172b4d}*HttpMethod: GET*{color}
>     ExchangeId: 34ff1f47-f18a-4b0a-a745-07a06a77f017
>     ServiceName: HelloWorld
>     PortName: HelloWorldHttpSoap11Endpoint
>     PortTypeName: IHelloWorld
>     Headers: \{sec-fetch-mode=navigate, sec-fetch-site=none, 
> Accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,
>  accept-language=en-US,en, sec-fetch-user=?1, sec-gpc=1, 
> sec-ch-ua="Not/A)Brand";v="99", "Brave";v="115", "Chromium";v="115", 
> sec-ch-ua-mobile=?0, sec-ch-ua-platform="Windows", host=localhost:8081, 
> upgrade-insecure-requests=1, connection=keep-alive, cache-control=max-age=0, 
> accept-encoding=gzip, deflate, br, sec-fetch-dest=document, 
> user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
> (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36}
> *01 Aug 2023 11:58:05,283  {color:#de350b}_POST_{color} INFO  
> [http-nio-8081-exec-13] IHelloWorld.FAULT_OUT - FAULT_OUT*
>     Content-Type: text/xml
>     ResponseCode: 500
>     ExchangeId: 34ff1f47-f18a-4b0a-a745-07a06a77f017
>     ServiceName: HelloWorld
>     PortName: HelloWorldHttpSoap11Endpoint
>     PortTypeName: IHelloWorld
>     Headers: {}
>     Payload: <soap:Envelope 
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soap:Body>
>     <soap:Fault>
>       <faultcode>soap:Server</faultcode>
>       <faultstring>Fault occurred while processing.</faultstring>
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>
>  
> Similarly if my first request is {*}GET{*}, all further requests (even with 
> POST) are showing as *GET.* 
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to