Resource loading uses absolute paths

UI Components for JSF
Post Reply
bluewing
Posts: 25
Joined: 14 Aug 2010, 19:02

13 Mar 2011, 17:13

Hello,

I have a problem with the PrimeFaces resource loading: it uses absolute path to load resources in the <head> section. Example:

Code: Select all

<link type="text/css" rel="stylesheet" href="/appName/javax.faces.resource/theme.css.jsf?ln=primefaces-humanity" />
I'm loading my resources like

Code: Select all

<link href="resources/css/home.css" rel="stylesheet" type="text/css" /> 
and I would like to keep it that way. Using absolute paths creates problems when I want to use Apache as a reverse proxy in front of GlassFish. I have the following Apache config:

Code: Select all

ProxyPass / https://192.168.1.10:44081/appName/
ProxyPassReverse / https://www.example.com/appName/
It is in a half-working state: the site works, but the PrimeFaces resources are not loaded. I could use absolute path names in my links to "fix" it, but I'd rather not do that. Is there an option to tell PrimeFaces to use relative paths?
GlassFish 3.1, Mojarra 2.1.0-FCS, Facelets, PrimeFaces 2.2.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

13 Mar 2011, 19:53

PrimeFaces uses standard JSF resource APIs, I think you need to write a custom resource handler, there is a getResourcePath() option method you can wrap.

http://download.oracle.com/javaee/6/api ... apper.html

bluewing
Posts: 25
Joined: 14 Aug 2010, 19:02

14 Mar 2011, 11:01

Thanks for pointing me in the right direction! If I use h:outputStylesheet tags to load my resources, JSF will translate them to link tags with absolute paths as well. I think that writing a custom resource handler for this purpose is overkill, I just set this application as default web module using GlassFish admin console.
GlassFish 3.1, Mojarra 2.1.0-FCS, Facelets, PrimeFaces 2.2.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 75 guests