8

I have my Wicket 1.4 code to have a link to download a file which is generated programatically:

protected class MyWebResource extends WebResource {
    public IResourceStream getResourceStream() {
        .....
        return new StringResourceStream(myString, "text/plain");
    }
}

ResourceLink<?> downloadLink = 
   new ResourceLink<Object>("downloadLink", new MyWebResource());

Everything was good. Now I've upgrade to Wicket 1.5. Now WebResource doesn't exist any more.

I've searched the web for ages, surely this must be a simple problem which has a simple solution? Alas I can't find it.

Stijn Geukens
  • 15,454
  • 8
  • 66
  • 101
Adrian Smith
  • 17,236
  • 11
  • 71
  • 93

1 Answers1

9

The replacement is AbstractResource. Basically you should create ResourceResponse and do what you did in its WriteCallback. See the specializations of AbstractResource in Wicket's code for examples. See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ as well.

martin-g
  • 17,243
  • 2
  • 23
  • 35
  • Hello martin. I am new to wicket and couldn't getting desired result through that example. Could u please elaborate linking part for me. Is it generating image on wicket page or simply providing a link because what I am getting is a link. – code_fish Dec 20 '12 at 07:32