[JAVASERVERFACES_SPEC_PUBLIC-820] Resolve Resource URLs in UIComponents Created: 20/Jun/10  Updated: 12/Aug/14

Status: Open
Project: javaserverfaces-spec-public
Component/s: Resources
Affects Version/s: 2.0
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: razib Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: All
Platform: All
URL: http://forums.java.net/jive/thread.jspa?messageID=395511

Issuezilla Id: 820
Status Whiteboard:

size_medium importance_medium


The purpose of this enhancement request is to make it easier to reference
resource URLs in custom components.

In JSF 2, a great EL shortcut was introduced to get the url for resources using
the resource implicit object (e.g. #resource['/library/image.jpg']). But there
is no easy programmatic way of resolving resource URLs inside a custom
component. For example if an image resource lies inside
META-INF/resources/library/image.jpg, there is no convenient way of referencing
the path of the image when writing an "img" tag inside my UIComponent.

Ideally such method should exist in ResourceHandler and users can invoke it
but resource handler has no such method to find a resource in META-INF/resources.

In lieu of this, you can do the following (Suggested by Ed Burns):

ResourceHandler rh = facesContext.getApplication.getResourceHandler();
Resource r = rh.createResource("image.jpg", "library");

This would work, but it is not as nice as getResourceHandler().getRequestPath().

This will give Component developers some ease, especially when there are
implementing components that deal with javascript extensively.


Comment by razib [ 20/Jun/10 ]

This is an enhancement request.

Comment by Ed Burns [ 22/Jun/10 ]


Comment by Ed Burns [ 22/Jun/10 ]


Comment by rogerk [ 27/Oct/10 ]


Comment by Ed Burns [ 01/Aug/14 ]

Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

Generated at Fri Sep 04 10:28:08 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.