Imageid is a array it seems, dont just call to string on it check if
it is an array and get the first element
On 5/5/08, V. Jenks <[EMAIL PROTECTED]> wrote:
>
> About 2 years ago (yeah, wow!) someone on this list helped me figure out how
> to load external images onto my pages and it worked perfectly, until I
> upgraded to 1.3.x from 1.2.4. I don't know much about the internals of how
> it works, it's a lot of code, and I really didn't care how it worked, it
> just did!
>
> Now that it's broken due to the upgrade, I'm trying to figure out what's
> going on and I think I've pinpointed where it's failing.
>
> The class signature looks like so:
>
> public class ImageResource extends DynamicWebResource
>
> ...and in there is a method that gets the ResourceState:
>
> protected ResourceState getResourceState()
>
> In there, I get the params:
>
> ValueMap params = getParameters();
>
> byte[] data = null;
> String imageId = params.get("file").toString();
>
> System.out.println("IMAGE ID: " + imageId);
>
> if
> (imageId.contains(PropertyProxy.getExternalImagesRoot()) ||
>
> imageId.contains(PropertyProxy.getExternalImagesAltRoot()))
> System.out.println("YES! - STRING CONTAINS IMAGE ROOT CONFIG
> PROPERTY!!!");
> else
> System.out.println("NO... - STRING DOES NOT CONTAIN IMAGE ROOT
> CONFIG PROPERTY.");
>
> So with this, I could make a call in a Wicket page like so:
>
> //get reference to Application's ResourceReference
> ResourceReference imageResource = new
> ResourceReference("imageResource");
>
> //build URL of image from file
> String imgUrl = RequestCycle.get().urlFor(imageResource) +
> "?file=C:\\MyApp\\assets\\images\\category\\Bundles.jpg";
>
> add(getContainer("bundleThumbImg", "src", imgUrl));
>
> However, now the "file" parameter can't be cast as a String, strangely
> enough, I get this output when running what I showed above:
>
> IMAGE ID: [Ljava.lang.String;@25249a
> NO... - STRING DOES NOT CONTAIN IMAGE ROOT CONFIG PROPERTY.
>
> This is where everything breaks down for me. I expected (and always got in
> Wicket 1.2.x) the actual value of the "file" param in the URL shown above.
>
> Can anyone offer any advice?
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/DynamicWebResource---ResourceState-acting-strange-in-1.3-tp17067666p17067666.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]