servlet-spec
  1. servlet-spec
  2. SERVLET_SPEC-9

Make web.xml accessible prior to ServletContext initialisation

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      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?

        Activity

        bleathem created issue -
        Rajiv Mordani made changes -
        Field Original Value New Value
        Assignee Shing Wai Chan [ swchan2 ]
        Hide
        rojkov added a comment -

        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.

        Show
        rojkov added a comment - 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.
        Hide
        bleathem added a comment -

        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.

        Show
        bleathem added a comment - 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.
        Hide
        Shing Wai Chan added a comment -

        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.

        Show
        Shing Wai Chan added a comment - 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.
        Shing Wai Chan made changes -
        Tags FUTURE_RELEASE
        Hide
        Shing Wai Chan added a comment -

        Adding it to the bucket of FUTURE_RELEASE

        Show
        Shing Wai Chan added a comment - Adding it to the bucket of FUTURE_RELEASE

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            bleathem
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: