Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8909

MDC variable ctx:HttpMethod gives always POST even for GET requests if first request is with POST

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.5.3
    • None
    • Core
    • None
    • Unknown

    Description

      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  POST INFO  [http-nio-8081-exec-13] IHelloWorld.REQ_IN - REQ_IN
          Address: http://localhost:8081/JavaFirstSpringSupport/services/HelloWorld
          HttpMethod: GET
          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  POST 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. 

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            Sreeni Sreenivas K
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: