You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Trent Larson <tr...@gmail.com> on 2008/11/07 18:49:27 UTC

cannot get ContextImage/Path to create the right path

I am trying to access different static images that aren't Wicket resources,
though their path is set programmatically by my Wicket pages; unfortunately
I'm seeing strange behavior.

My wicket app is installed under "/myContext/wicketStuff" (with wicketFilter
url-pattern pointing to 'wicketStuff'), but my images are found at the top
level under "/myContext/images", eg. "images/en_US/junk.gif".  I'm trying to
point to different ones based on Locale (rather than use the nice classpath
resources, at least for now), so I'm trying the following:

String locale = "en_US";
add(new ContextImage("currentJunk", "images/" + locale + "/junk.gif"));

... or:

add(new Image("currentJunk").add(new ContextPathGenerator("images/" + locale
+ "/junk.gif")));

My HTML is simple:
<img wicket:id="currentJunk" />

The output is strange: it puts my path argument at the front of the URL, and
then it adds a "/../" at the end:

<img src="images/en_US/junk.gif/../" wicket:id="currentJunk">

This seems like a bug; why would it put stuff at the end?  Manually
configuring the context (eg. in web.xml) seems fraught with danger.  I could
probably work with it if it would put that at the beginning or even not put
anything at all, and I could specify the path.

I'm using version 1.4-m3

I appreciate any help or even other suggestions.  Thanks!
Trent

Re: cannot get ContextImage/Path to create the right path

Posted by Igor Vaynberg <ig...@gmail.com>.
this issue has already been fixed. you can either compile trunk or
wait for m4 to go official

-igor

On Fri, Nov 7, 2008 at 9:49 AM, Trent Larson <tr...@gmail.com> wrote:
> I am trying to access different static images that aren't Wicket resources,
> though their path is set programmatically by my Wicket pages; unfortunately
> I'm seeing strange behavior.
>
> My wicket app is installed under "/myContext/wicketStuff" (with wicketFilter
> url-pattern pointing to 'wicketStuff'), but my images are found at the top
> level under "/myContext/images", eg. "images/en_US/junk.gif".  I'm trying to
> point to different ones based on Locale (rather than use the nice classpath
> resources, at least for now), so I'm trying the following:
>
> String locale = "en_US";
> add(new ContextImage("currentJunk", "images/" + locale + "/junk.gif"));
>
> ... or:
>
> add(new Image("currentJunk").add(new ContextPathGenerator("images/" + locale
> + "/junk.gif")));
>
> My HTML is simple:
> <img wicket:id="currentJunk" />
>
> The output is strange: it puts my path argument at the front of the URL, and
> then it adds a "/../" at the end:
>
> <img src="images/en_US/junk.gif/../" wicket:id="currentJunk">
>
> This seems like a bug; why would it put stuff at the end?  Manually
> configuring the context (eg. in web.xml) seems fraught with danger.  I could
> probably work with it if it would put that at the beginning or even not put
> anything at all, and I could specify the path.
>
> I'm using version 1.4-m3
>
> I appreciate any help or even other suggestions.  Thanks!
> Trent
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org