eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
160 stars 109 forks source link

"javax.faces.WEBAPP_RESOURCES_DIRECTORY" behavior is not correct. #5118

Closed fukumotyo closed 2 years ago

fukumotyo commented 2 years ago

Describe the bug

The API document below states that it must not start with a "/", but if it does not start with a "/", it will not work.

ResourceHandler#WEBAPP_RESOURCES_DIRECTORY_PARAM_NAME

To Reproduce

Steps to reproduce the behavior:

  1. Set the following in web.xml
    <context-param>
    <param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
    <param-value>WEB-INF/resources</param-value>
    </context-param>
  2. Describe the resource to be loaded in the JSF file.
    <h:outputScript library="myjs" name="myapp.js" />
    <h:outputStylesheet library="mycss" name="mystyle.css" />
  3. Create the following resource files
    WEB-INF/resources/myjs/myapp.js
    WEB-INF/resources/mycss/mystyle.css

Expected behavior

Resource files described in the JSF file must be loaded.

BalusC commented 2 years ago

Wow, that's an awkward oversight there.

The original spec issue is this: https://github.com/jakartaee/faces/issues/996 There's even a comment pointing out this deviation: https://github.com/jakartaee/faces/issues/996#issuecomment-518574116 I guess the deviation was caused by mix-up of two initial proposals as commented here: https://github.com/jakartaee/faces/issues/996#issuecomment-518574106

For now the Mojarra impl should silently prepend the / when absent and we'll need a new spec ticket to adjust or drop this requirement.

fukumotyo commented 2 years ago

I should have added at the beginning that WEBAPP_CONTRACTS_DIRECTORY has the same problem.

The operation was closed by mistake and will be reopened.

BalusC commented 2 years ago

Confirmed. I'll adjust that one as well.