Use a relative URL - that's what I did. Granted my context root isn't
the portal root, but it still resolves correctly for me on WebSphere
portal and Jboss portal. I'd try to figure out why liferay is vomiting
on the relative URL. If it doesn't like leaving out the leading "/", try
putting in a "./".

 

-----Original Message-----
From: Henrik Bentel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 11, 2005 3:58 PM
To: [email protected]
Subject: graphicImage and root context in portal

Hi

I have a feeling my question should be asked a different place, but
I'll ask here anyways.

Description:
I'm trying to use the graphicImage component (aka HtmlGraphicImageTag)
in a JSF portlet.
The portal serving the portlet runs as the root context of the server.
The portal is Liferay 3.6
So if I want to directly reference my webapp resources the URL's would
look like this:
http:HOSTIP/welcome.jsp and http:HOSTIP/styles.css

Problem:
In one of the JSP pages I use the GraphicImage Tag inside a Tree2
component to display images of folders.
My problem is the URLs generated in the HTML document.

>From this tag:
 <t:graphicImage value="/images/yellow-folder-closed.png"
                     rendered="#{!t.nodeExpanded}" border="0"/>

I get:
<img id="irrelevantId" src="//images/yellow-folder-closed.png"
border="0"/>

On firefox(and I assume maybe Internet Exploder) this doesn't work.
The double slash ruins it.
It works fine it you put the URL directly in the addressbar, like so:
http://HOSTIP//images/yellow-folder-closed.png , the browser resolves
this double slash fine.
But it seems inside a HTML document .. not soo much. Result is a missing
image.

If I try to remove the first '/' the portal chockes cheetos like so:
java.lang.IllegalArgumentException: URL path must start with a '/' or
include '://'
        at
com.liferay.portlet.RenderResponseImpl.encodeURL(RenderResponseImpl.java
:119)
        at
org.apache.myfaces.context.portlet.PortletExternalContextImpl.encodeReso
urceURL(PortletExternalContextImpl.java:197)
        at
org.apache.myfaces.renderkit.html.HtmlImageRendererBase.encodeEnd(HtmlIm
ageRendererBase.java:69)

So it seems I must pass in an absolute path (or full server address)
as the value of the URL.

Short of doing full url, is there anything else I can do to make the
URLs correct.?
Does anyone have any experience with this inside a portal?

thanks
Henrik Bentel

Reply via email to