Skip to content
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

ServletContext should be injected #37

Open
testn opened this issue Oct 16, 2015 · 3 comments
Open

ServletContext should be injected #37

testn opened this issue Oct 16, 2015 · 3 comments

Comments

@testn
Copy link

testn commented Oct 16, 2015

It looks like currently ServletContext is not injected. It would be nice to have it injected so that it can access ServletContext.getAttribute/setAttribute as a caching mechanism.

@adrianluisgonzalez
Copy link
Member

The issue when using vertx-jersey is you are not running inside a web container so there is not a ServletContext to inject. The vert.x HttpServerRequest/HttpServerResponse does not implement ServletRequest/ServletResponse.

However there is nothing stopping you from implementing your own ServletContext and binding it for injection as a singleton to use for getAttribute()/setAttribute().

However, if all you want is getAttribute()/setAttribute(), then consider using vert.x's shared data:
http://vertx.io/docs/vertx-core/java/#_using_shared_data_with_vert_x

@adrianluisgonzalez
Copy link
Member

@testn any further discussion on this topic?

@testn
Copy link
Author

testn commented Nov 23, 2015

I think it's sometimes important to have at least a fake implementation of ServletContext. A good example is swagger. Swagger uses ServletContext to cache the swagger definition without making the resource to be a singleton.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants