Correction:
PackageResource packageResource = PackageResource.get(Page2.class,
"image.png");

does correctly set response headers (to allow for 304). But, for some
reason, the link generated is not static and is instead tied to an
HttpSession. Any way to get a Session-independent packageResource (for
static image)?

On Tue, Apr 13, 2010 at 6:05 PM, Nikita Tovstoles <
[email protected]> wrote:

> Given this page:
> public class Page2 extends WebPage {
>
> public Page2() {
>
>  add(new Image("plainImage", "image.png"));
>  PackageResource packageResource = PackageResource.get(Page2.class,
> "image.png");
>  add(new Image("pkgImage", packageResource));
> }
> }
>
> "plainImage" produces an img that returns a 304 on page reload; and is not
> tied to a session.
>
> "pkgImage", however, renders as a 'wicket:interface' url that actually
> re-loads an image (200) on page reload, and is tied to a session (throws
> PageExpiredException) when session expires or sessionid is removed from img
> src.
>
> Is there way to get a (Package)Resource that is not session-specific? I see
> a SharedResources but am unsure how to access it. We need to new Image in
> several places whose source paths are computed at render time from page
> params, yet are always relative to the same component class (support of
> multiple L&F).
>
> I recognize that we could use a ContextImage instead, but I am curious to
> find an approach that would also work for JS/CSS.
>
> thanks
> -nikita
>
>

Reply via email to