jakartaee / faces

Jakarta Faces
Other
107 stars 55 forks source link

Support library prefix in resource URLs #884

Open eclipse-faces-bot opened 14 years ago

eclipse-faces-bot commented 14 years ago

Consider a stylesheet

Resources are loaded with URLs such as

/context path/faces/javax.faces.resource/skin.css?ln=styles

(when prefix mapping is used).

CSS files commonly contain url(...) expressions such as

.ui-icon

{ width: 16px; height: 16px; background-image: url(myicon.png); }

These url(...) expressions fail to locate the dependent resources.

This discussion further explains the problem: http://forums.sun.com/thread.jspa?threadID=5447194.

It is not reasonable to ask the users to rewrite the URLs in the style sheet since style sheets are often auto-generated.

While it might be possible for JSF to automatically rewrite the URLs in a style sheet as it is loaded, that would not work for other files (e.g. JavaScript).

If instead the library name is added as a prefix, then the problem goes away:

/context path/faces/javax.faces.resource/styles/skin.css

(NB. I believe the ?ln=xxx is a vestige of an earlier time when the version and resource prefix were also specified as request parameters, see http://blogs.sun.com/rlubke/entry/jsf_2_0_new_feature.)

In the interest of backward compatibility, we can to provide an application configuration parameter

javax.faces.RESOURCE_URL_MAPPING with options prefix and param

Then http://download-llnw.oracle.com/javaee/6/api/javax/faces/application/Resource.html#getRequestPath%28%29 needs to be changed as follows:

  1. If getLibraryName() returns non-null, discover if the resources are prefix or param mapped, by consulting the application configuration parameter javax.faces.RESOURCE_URL_MAPPING. If prefix mapped, insert "/" + getLibraryName() after ResourceHandler#RESOURCE_IDENTIFIER. If param mapped, ...

    Environment

    Operating System: All Platform: All

    Affected Versions

    [2.0]

eclipse-faces-bot commented 5 years ago
eclipse-faces-bot commented 14 years ago

@glassfishrobot Commented Reported by cayhorstmann

eclipse-faces-bot commented 14 years ago

@glassfishrobot Commented @edburns said: 2.2

eclipse-faces-bot commented 14 years ago

@glassfishrobot Commented rogerk said: triage

eclipse-faces-bot commented 13 years ago

@glassfishrobot Commented ramiromagalhaes said: This is duplicated by #900.

eclipse-faces-bot commented 13 years ago

@glassfishrobot Commented lamine_ba said: It seems that someone has reported this issue since a long time . It was one of the first issue I have to deal with JSF 2.0. How to load with css an image stored in my images folder? If my faces servlet is mapped to .faces, I can overcome this problem by doing this

background-image: url(myicon.png.faces?ln=images)

If my faces servlet is mapped to /faces/*, I can overcome this problem by doing this

background-image: url(myicon.png?ln=images)

If would be nice if we could come back to this

background-image: url(images/myicon.png)

eclipse-faces-bot commented 13 years ago

@glassfishrobot Commented jakobkorherr said: The problem described by lamine_ba is exactly why I created the MyFaces commons resourcehandler module (see [1]). Fortunately I already talked with Ed about it, and we will try to address this issue by re-using some of the code/concepts from MyFaces commons resourcehandler!

[1] https://svn.apache.org/repos/asf/myfaces/commons/branches/jsf_20/myfaces-commons-resourcehandler/

eclipse-faces-bot commented 10 years ago

@glassfishrobot Commented @edburns said: Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

eclipse-faces-bot commented 14 years ago

@glassfishrobot Commented Parent-Task: JAVASERVERFACES_SPEC_PUBLIC-947

eclipse-faces-bot commented 14 years ago

@glassfishrobot Commented Issue-Links: duplicates JAVASERVERFACES_SPEC_PUBLIC-947 is duplicated by JAVASERVERFACES_SPEC_PUBLIC-900

eclipse-faces-bot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-884