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

Make web.xml accessible prior to ServletContext initialisation #9

Open
glassfishrobot opened this issue Sep 6, 2011 · 10 comments
Open
Labels
Enhancement New feature or request

Comments

@glassfishrobot
Copy link

It would be useful if one could access the contents of the web.xml file, prior to the ServletContext being available.

A use case for this is in writing CDI extensions, where it would be useful to access web.xml configuration data. Currently this is not possible to achieve in a portable way, as the ServletContext has not yet started, and is not available to CDI extensions (in EE environments at least).

Since the WEB-INF folder is not on the classpath, using the context ClassLoader is not possible. Perhaps the solution to this is as simple as adding the WEB-INF folder to the application classpath?

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by bleathem

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
rojkov said:
I think this needs a use case. I can't not suggest that parsing web.xml yet another time should be avoided. Possibly, we can define a pre-start phase that makes the xml available in parsed state.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
bleathem said:
A use case is as I stated in the issue description, where one wants to access the web.xml from a CDI extension. For instance, to determine the JSF project stage, to conditionally activate different beans in production and development.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@shingwaichan said:
At this time, we don't expose the content of web.xml in Servlet API.
Where do you want to access the information contained in the descriptor and how can we reconcile the information specified by annotation?
It will be consider in the future release.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@shingwaichan said:
Adding it to the bucket of FUTURE_RELEASE

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@edburns said:
Would it be sufficient to just make the WEB-INF/web.xml accessible or must all the fragements be considered as well? Also, we need to consider how useful this is in the case where the configuration comes from annotations.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
gregwilkins said:
Also it would be good to have "prior to ServletContext initialisation" defined. Is this during calls to ServletContainerInitializers? In which case much of the content of the web.xml is available via API (and if not then we could add some more API).

I would really rather avoid encouraging other parsing web.xml, as this does not cover configuration from fragments, API, annotation etc.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA SERVLET_SPEC-9

@glassfishrobot
Copy link
Author

@manorrock
Copy link

@gregw My suggestion here would be to look at what is missing from the ServletContext API that those CDI extensions are looking for. As CDI is bootstrapped using a ServletContainerInitializer it can access the ServletContext API at that time. Where the actual configuration came from should be irrelevant to the CDI extension as the ServletContext API is the 'materialized view' of a web application where configuration is concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants