Is there a way to access the CXF message exchange from a JAX-RS REST Resource within CXF?

后端 未结 2 540
挽巷
挽巷 2021-01-22 02:35

Currently we have a a RESTful API using CXF 2.4.2. In one of my resource methods, I would like to process some query parameters and store the result in the CXF message exchange

相关标签:
2条回答
  • 2021-01-22 02:50

    The easiest, if using CXF, is to just do:

    PhaseInterceptorChain.getCurrentMessage()
    

    That will work in JAXWS and JAXRS services.

    0 讨论(0)
  • Injecting org.apache.cxf.jaxrs.ext.MessageContext should do too but the code Dan suggests will lead to a simpler code in case of combining JAXWS & JAXRS

    0 讨论(0)
提交回复
热议问题