开发者

WebSphere Portal 6.1.5 theme portal-logic:findUrlInTheme, find url to resource outside theme

I'm deploying several themes in one war archive. The themes are located in the webapp under /themes/html/. I'm trying to get the different themes to create links to resources in a "common" folder that is not a theme in itself, but placed in /themes/html/common. Specifically, my themes Default.jsp should link to scripts, images and stylesheets in the common folder.

So far I've been trying several different approaches

<link href='<portal-logic:urlFindInTheme file="../common/styles/main.css" />' type="text/css" rel="stylesheet"/>

No luck, just prints "about:blank" as href

I then experimented with registering the common folder as it's own theme ("called it CommonResources") and tried

<link href='<portal-logic:urlFindInTheme file="/styles/main.css" theme="CommonRes开发者_JAVA技巧ources"/>' type="text/css" rel="stylesheet"/>

Same result, "about:blank". I have also tried various variations of portal-logic:urlFind

<link href='<portal-logic:urlFind file="../common/styles/main.css" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="/common/styles/main.css" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="main.css" path="/common/styles" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="main.css" path="/common/styles" root="/" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="main.css" path="/styles" root="/common" />' type="text/css" rel="stylesheet"/>

Same there, no luck. These don't event bring about:blank, just empty string in the href.

Alternativly, i tried this

<link href="<%= request.getContextPath() %>/themes/html/common/styles/main.css" type="text/css" rel="stylesheet" />

Problem with that is that request.getContextPath() returns an empty string. I could hard-code the context to the theme app, but I would prefer to avoid this for obvious reasons.

The IBM documentation is, as usual, completely useless. This is about everything documented in the infocenter and I have not been able to come across anything more useful. Decompiling IBM jar:s have become almost second nature to me, but trying to follow the internal finder logic in the portal is just giving me massive headaches.

So, have anyone had any luck with accessing external resources from inside a theme app? You'd think this was something commonly done, but I'm starting to wonder.


Answering my own question...

Turns out the problem was url caching inside the WAS.

<link href='<portal-logic:urlFindInTheme file="../common/styles/main.css" />' type="text/css" rel="stylesheet"/>

Is correct and works. My problem was that websphere had already cached that /common/styles/main.css didn't exist from a previous request (before I deployed it there). Seems these URL caches don't get purged just because you redeploy an application. I changed the folder name to common2 and redeployed just to force WebSphere to re-run the internal finder and then it worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜