-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to inject ServletContext into Application constructor #2456
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented It seems as if this is caused by the provider of the ServletContext binding, WebComponentBinder, not taking effect until resourceConfig.configureMetaProviders. Unfortunately configureMetaProviders is called after the creation of the Application even though the registration of the binder, which seems to only stick it somewhere for holding, happens before. A second call to configureMetaProviders before the creation of the application does fix the injection, but I don't understand the binder registration and other things well enough to know if it breaks anything else by calling it twice. Maybe if the Application tries to override some existing built-in injection? All tests as part of the normal build still pass, though.
I suppose similar would need to also be done for the other constructor. |
@glassfishrobot Commented @q3aiml: thanks a lot, but finally I went for a different fix. |
@glassfishrobot Commented |
@glassfishrobot Commented |
|
Jersey runs on top of ServletContainer. We should be able to pass servlet init parameters using web.xml and read them from Application by injecting ServletContext and using ServletContext.getInitParameter(). Currently, injecting @context ServletContext into Application's constructor results in a null value.
Affected Versions
[2.4]
The text was updated successfully, but these errors were encountered: