ResourceReference that contains relative paths

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ResourceReference that contains relative paths

Ravi
Hi,

I have the following scenario:
My packages look like:
-bootstrap
--css
---BootstrapCssResourceReference.java
---bootstrap.css
--fonts
---glyphicons-halflings-regular.eot

In that css file bootstrap defines its font by referencing a relative path (src:url(../fonts/glyphicons-halflings-regular.eot)
The BootstrapCssResourceReference has the following url:
http://localhost:8080/webapp/wicket/resource/some.package.bootstrap.css.BootstrapCssResourceReference/bootstrap.min-ver-1495022368739.css

Now when the browser resolves the relativ font url, it comes up with
http://localhost:8080/webapp/wicket/resource/fonts/glyphicons-halflings-regular.eot
Obviously it won't find anything there.

I'm wondering what is the best way of dealing with that kind of references? I could mount a ResourceReference for each file, but maybe there is a better way?

Thanks for your time,

Ravi


Reply | Threaded
Open this post in threaded view
|

Re: ResourceReference that contains relative paths

Martin Grigorov-4
Hi,

The easiest solution is to move BootstrapCssResourceReference.java one
level up and change the relative path to: css/bootstrap.css

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, May 17, 2017 at 2:03 PM, Ravi <[hidden email]> wrote:

> Hi,
>
> I have the following scenario:
> My packages look like:
> -bootstrap
> --css
> ---BootstrapCssResourceReference.java
> ---bootstrap.css
> --fonts
> ---glyphicons-halflings-regular.eot
>
> In that css file bootstrap defines its font by referencing a relative path
> (src:url(../fonts/glyphicons-halflings-regular.eot)
> The BootstrapCssResourceReference has the following url:
> http://localhost:8080/webapp/wicket/resource/some.package.bootstrap.css.
> BootstrapCssResourceReference/bootstrap.min-ver-1495022368739.css
>
> Now when the browser resolves the relativ font url, it comes up with
> http://localhost:8080/webapp/wicket/resource/fonts/
> glyphicons-halflings-regular.eot
> Obviously it won't find anything there.
>
> I'm wondering what is the best way of dealing with that kind of references?
> I could mount a ResourceReference for each file, but maybe there is a
> better
> way?
>
> Thanks for your time,
>
> Ravi
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/
> ResourceReference-that-contains-relative-paths-tp4677885.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ResourceReference that contains relative paths

Ravi
This post was updated on .
Hi Martin, thank you for your answer.

The thing is that we don't want to touch the css, so that we can easily upgrade without having to customize the files.
For now I mounted all fonts to the requested path in my Application class.
Although it works, it does not feel exactly right...

With bootstrap in combination with CssResourceReference that would be a fairly common problem/scenario?!
 
Reply | Threaded
Open this post in threaded view
|

Re: ResourceReference that contains relative paths

Martin Grigorov-4
Hi,

I didn't meant to modify the .css files.
Just move the Reference class one level up in the packages and fix its path
to the .css file. That's all.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, May 19, 2017 at 8:38 AM, Ravi <[hidden email]> wrote:

> Hi Martin, thank you for your answer.
>
> The thing is that we don't want to touch the css, so that we can easily
> upgrade without having to customize the files.
> For now I mounted all fonts to the requested path in my Application class.
> Although it works, it does not feel exactly right...
>
> With bootstrap in combination with CssResourceReference that would be a
> fairly common problem?!
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/
> ResourceReference-that-contains-relative-paths-tp4677885p4677909.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ResourceReference that contains relative paths

Ravi
Ok, I got it. Thank you for clarifying!!!

Ravi