Mailing List webobjects-dev@wocommunity.org Message #532
From: Hugi Thordarson <hugi@karlmenn.is>
Subject: Re: [WO-DEV] Dynamic URL in CSS
Date: Wed, 8 Oct 2025 13:45:39 +0000
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
On a related note;

this thread revived my interest in simplifying WO's serving of "WebServerResources" and getting rid of the "split install", so I wrote a ResourceManager/RequestHandler combo last weekend for serving WebServerResources from the application.
Since it's something I *really* want, I've started dogfooding, deployed it in all of my apps and it works seemingly well. Nice to have the same simple URLs for all resources in both dev and prod, and *very* nice not having to worry about any web server files. It's a part of wonder-slim, but should work fine in any Wonder app:

https://github.com/undur/wonder-slim/blob/master/ERExtensions/src/main/java/er/extensions/resources/ERXResourceManagerExperimental.java

Example in production (see for example; URLs for scripts and stylesheets in the page header):

https://www.neytandinn.is/

Still has a couple of outstanding issues, as seen from the FIXME/TODO list at the top of the file. But once those are done, I'd like to revisit another related old dream, post-processing (specifically; templating) of webserver-resources. Did a little testing, just to see how it would work out to process a simple string template…

https://gist.github.com/hugithordarson/357f7ac603e2d9a4b69daa495d4ece11

…but I think a generic solution for this could and should be written into the application-based request handler. Hope to have time to get to work on that during next weekend.

Cheers,
- hugi



> On 8 Oct 2025, at 12:16, Samuel Pelletier <samuel@samkar.com> wrote:
>
> Hi Markus,
>
> I have some of these in css files and it works if you use relative urls in your css like this:
>
> background-image: url(../img/rapportOrientation/logo/texte.svg);
>
> The base path is the effective css file path, this exemple is expanded to this when running in Eclipse:
>
> http://127.0.0.1:2324/cgi-bin/WebObjects/GCAGestion.woa/_wr_/wodata=/Users/sam/work/KavijuWoMaven/GCARapports/src/main/webserver-resources/img/rapportOrientation/couvertureInteractive/promoteur.jpg
>
> In my project, webserver-resources contains css, fonts, img, js and and scss folders.
>
>  Regards,
>
> Samuel
>
>
>> Le 1 oct. 2025 à 08:53, Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch> a écrit :
>>
>> I have a large customer application that has nicely structured CSS files. Unfortunately in one of them there are some absolute references to WebServerResources
>>
>> background-image: url(“/MyApp/images/logo.png");
>>
>> This fails when the file is in WebServerResources. Up to now my customer had all resources served statically from Apache. This works in production but is not portable and breaks in Eclipse on my dev machine.
>>
>> What would be the best way to convert such CSS URLs? I cannot just put a WOResourceURL in there or some such because the definition is in a separate .css file in WebServerResources, not in a WOComponent.
>>
>> How to best deal with such things?
>>
>> Thanks for any tip and help
>> ---markus---
>>
>>
>>
>

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster