jersey
  1. jersey
  2. JERSEY-1967

Injecting proxiable request-scoped instances as resource method parameters/resource fields should not inject proxies.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: core
    • Labels:
      None

      Description

      See JERSEY-1905 - the current solution does not work for injectable resource method parameters, only for request scoped instance fields.

        Issue Links

          Activity

          Hide
          Marek Potociar added a comment - - edited

          To start, see DelegatedInjectionValueFactoryProvider and ContextInjectionResolver Jersey classes.

          Also, the tests ignored in ProxyInjectablesTest should pass with the fix.

          Show
          Marek Potociar added a comment - - edited To start, see DelegatedInjectionValueFactoryProvider and ContextInjectionResolver Jersey classes. Also, the tests ignored in ProxyInjectablesTest should pass with the fix.
          Hide
          Jakub Podlesak added a comment - - edited

          Asked John from HK2 for help. John filed HK2-128 and suggested the following workaround:
          cast lookup result to HK2 ProxyCtl and call it's __make method to get access to the wrapped instance. Going to implement the workaround just to unblock JERSEY-1761.
          Although an HK2 lookup API addition would be needed to fix this properly (i presume proxy creation
          will keep causing performance issues, so we need to avoid creating unnecessary proxies).

          Show
          Jakub Podlesak added a comment - - edited Asked John from HK2 for help. John filed HK2-128 and suggested the following workaround: cast lookup result to HK2 ProxyCtl and call it's __make method to get access to the wrapped instance. Going to implement the workaround just to unblock JERSEY-1761 . Although an HK2 lookup API addition would be needed to fix this properly (i presume proxy creation will keep causing performance issues, so we need to avoid creating unnecessary proxies).
          Hide
          Jakub Podlesak added a comment -

          HK2-128 fix is needed to get rid of proxy creation completely when proxy is not required

          Show
          Jakub Podlesak added a comment - HK2-128 fix is needed to get rid of proxy creation completely when proxy is not required
          Hide
          Jakub Podlesak added a comment -

          This should also cover injecting request-scoped proxiables into resource fields using @Context annotation.
          So far there is a working solution (in review process) for:

          • injecting method parameters
          • injecting resource fields using @Inject annotation

          TODO:

          • injecting resource fields using @Context annotation
          Show
          Jakub Podlesak added a comment - This should also cover injecting request-scoped proxiables into resource fields using @Context annotation. So far there is a working solution (in review process) for: injecting method parameters injecting resource fields using @Inject annotation TODO: injecting resource fields using @Context annotation
          Hide
          Jakub Podlesak added a comment -

          Fixed in the main trunk.

          Show
          Jakub Podlesak added a comment - Fixed in the main trunk.

            People

            • Assignee:
              Jakub Podlesak
              Reporter:
              Marek Potociar
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 18 hours
                18h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours Time Not Required
                6h