javaee / jersey

This is no longer the active Jersey repository. Please see the README.md
http://jersey.github.io
Other
2.86k stars 2.36k forks source link

Make AbstractHttpContextInjectable available in the SPI #532

Closed glassfishrobot closed 9 years ago

glassfishrobot commented 15 years ago

Changes in Jersey 1.0.0 -> 1.0.2 for better DI integration meant the the Injectable interface method getValue(HttpContext) became getValue(). Any implementers of this interface had to change to using injection to obtain the HttpContext of the current request.

However, the Jersey implementation contains an AbstractHttpContextInjectable class containing a getValue(HttpContext) method, which is treated as a special case by the internals and is a slight optimization over the injection approach.

I'm suggesting making the AbstractHttpContextInjectable (or something similar, it would currently require a small change to the implementation of getValue()) available in the SPI so implementers can also make use of that feature. I believe this is a benifit for a couple of reasons:

1) Implementers have a choice in how to implement Injectables, i.e. if you are developing an injectable that you know will only be used server side then you may wish to benefit from AbstractHttpContextInjectable, if not then you can still implement Injectable directly & use injection for HttpContext if required.

2) The Jersey implementation will become a better example of 'best practices' in how to use the framework, rather than having its own internal way of doing things which will be tempting for implementers to rely on, especially if any other way of achieving the same goal is not clear.

Environment

Operating System: All Platform: All

glassfishrobot commented 15 years ago

Reported by tedwards@java.net

glassfishrobot commented 9 years ago

@mpotociar said: This issue has been already deferred to "ice box". Also, it has not collected any support votes and has not been updated this year at all. Closing as won't fix due to not enough interest from the community.

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JERSEY-260

glassfishrobot commented 9 years ago

Marked as won't fix on Thursday, September 10th 2015, 12:08:51 pm