Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-2797

CXF JAXRS services cannot share JAXRS providers with injectable (annotated) fields

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • High
    • Resolution: Fixed
    • None
    • 2.28.00
    • None
    • None

    Description

      HST JAXRS Services, as configured through the CXFJaxrsService class, each setup a CXF bus for their own.
      However, CXF manages JAXRS injectable (annotated) fields through ThreadLocal proxies, which it caches within the bus associated with each service.
      Sharing (singleton) providers, like for example a CrossOriginResourceSharingFilter (CORS) then can cause execution failures because CXF might use the wrong ThreadLocal proxy to inject context parameters and values, for example as noticed with issue GOGREEN-1195.

      After detailed review of the CXF internal processing, this turns out to be (best) solvable by forcing the HST JAXRS Services to all use one/single CXF bus. This is also the typical/common usage pattern by CXF.

      Using a separate CXF bus for multiple endpoints seemingly never has been considered a use-case, or at least not with also using shared singleton providers...

      The current implementation however uses the separate CXF bus per JAXRS service to register individual (possibly service specific) interceptors, which therefore now needs to be handled differently.
      As interceptors also can be registered on the eindpoint created specifically for each JAXRS Service, this can be resolved relatively easy.

      The solution will be to make all CXFJaxrsService instances use the CXF default bus only, e.g. use BusFactory.getDefaultBus().
      No specific bus configuration will be set anymore (which thereby would become shared).
      If specific shared (default) bus configuration is needed, this then can be done separately from the CXFJaxrsService configuration itself (like through Spring <cxf:bus> configurations).

      Attachments

        Issue Links

          Activity

            People

              jsheriff Junaidh Kadhar Sheriff
              adouma Ate Douma
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: