Quantcast

migrating from 1.4 to 1.5 - some images problems

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

migrating from 1.4 to 1.5 - some images problems

samzilverberg
Hi,

First let me say that I already searched through nabble and stackoverflow
but didn't find a good solution to, what seems to me, a simple problem.

I'm migrating my app from 1.4.17 to 1.5.5.
In 1.4 I put a lot of images under webapp/ui/images .
I'd use images from that folder mainly for css and javascript options:
css:  background: url("ui/images/logo_new_trans.gif") no-repeat scroll 0 0
transparent;
js : $(#bla}.something(buttonImage:'ui/images/datepicker.png');

I'm using wiquery so the above image url for js was put in using java code
- the url was determined at run time.

After migrating to 1.5 the css referenced images work but the JS do not.
If I play around using firebug i can get the JS images to work by adding
"../" before the existing url.

What is a good way of getting this to work again?
Can I somehow use wicket to resolve the url from a component to the static
dir?  so when I programatically pass the url using wiquery I can put in the
correct one...

Thanks,
Sam
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: migrating from 1.4 to 1.5 - some images problems

Sebastien
Hi Sam,

I think you can use this:
UrlUtils.rewriteToContextRelative("ui/images/datepicker.png",
RequestCycle.get());

It also works in Wicket 6.

Regards,
Sebastien.

On Tue, Jul 10, 2012 at 7:22 PM, Sam Zilverberg <[hidden email]>wrote:

> Hi,
>
> First let me say that I already searched through nabble and stackoverflow
> but didn't find a good solution to, what seems to me, a simple problem.
>
> I'm migrating my app from 1.4.17 to 1.5.5.
> In 1.4 I put a lot of images under webapp/ui/images .
> I'd use images from that folder mainly for css and javascript options:
> css:  background: url("ui/images/logo_new_trans.gif") no-repeat scroll 0 0
> transparent;
> js : $(#bla}.something(buttonImage:'ui/images/datepicker.png');
>
> I'm using wiquery so the above image url for js was put in using java code
> - the url was determined at run time.
>
> After migrating to 1.5 the css referenced images work but the JS do not.
> If I play around using firebug i can get the JS images to work by adding
> "../" before the existing url.
>
> What is a good way of getting this to work again?
> Can I somehow use wicket to resolve the url from a component to the static
> dir?  so when I programatically pass the url using wiquery I can put in the
> correct one...
>
> Thanks,
> Sam
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: migrating from 1.4 to 1.5 - some images problems

samzilverberg
I tried these methods but they didn't work.
They still calculated the url to be /ui/images/datepicker.png.

I found the problem.
The page is a stateful and unmounted page.
In wicket 1.4 these pages url would rendered as
/context/?wicket:interface=:4::::
In wicket 1.5 the url is /context/wicket/page?3
That's why the extra ../ worked .

I'll solve this problem either by finding out how to render the url so it's
more like in wicket 1.4 or by putting in an absolute url to the image :
/contextname/ui/images/datepicker
I have no problem with the app knowing its context name...

@Paul
Migration is a bitch.
I never intended to go past 1.4.x with my app.
wicket 6 features got me excited , I really want wicket to use jquery lib
instead of homebrewed javascript solutions.
But migrating over 2 major versions is a pain in the ass, so I'm first
migrating to 1.5.x.
The migration guide covers a lot of issues, but not all, so I will find
myself looking for solutions in the mailing lists and on stackoverflow
quite a lot.

If your app is stable and you don't think you'll benefit from the new
features, just stay on 1.3.x.
If you still want to migrate I suggest you migrate to 1.4.x (17 or above)
first and then decide if you want to go on to 1.5.



On Tue, Jul 10, 2012 at 10:16 PM, Sebastien <[hidden email]> wrote:

> Hi Sam,
>
> I think you can use this:
> UrlUtils.rewriteToContextRelative("ui/images/datepicker.png",
> RequestCycle.get());
>
> It also works in Wicket 6.
>
> Regards,
> Sebastien.
>
> On Tue, Jul 10, 2012 at 7:22 PM, Sam Zilverberg <[hidden email]
> >wrote:
>
> > Hi,
> >
> > First let me say that I already searched through nabble and stackoverflow
> > but didn't find a good solution to, what seems to me, a simple problem.
> >
> > I'm migrating my app from 1.4.17 to 1.5.5.
> > In 1.4 I put a lot of images under webapp/ui/images .
> > I'd use images from that folder mainly for css and javascript options:
> > css:  background: url("ui/images/logo_new_trans.gif") no-repeat scroll 0
> 0
> > transparent;
> > js : $(#bla}.something(buttonImage:'ui/images/datepicker.png');
> >
> > I'm using wiquery so the above image url for js was put in using java
> code
> > - the url was determined at run time.
> >
> > After migrating to 1.5 the css referenced images work but the JS do not.
> > If I play around using firebug i can get the JS images to work by adding
> > "../" before the existing url.
> >
> > What is a good way of getting this to work again?
> > Can I somehow use wicket to resolve the url from a component to the
> static
> > dir?  so when I programatically pass the url using wiquery I can put in
> the
> > correct one...
> >
> > Thanks,
> > Sam
> >
>
Loading...