See http://cwiki.apache.org/WICKET/showing-a-remote-image-on-wicket-site.html
for similar example ** Martin 2009/8/11 Edgar Merino <[email protected]>: > Hello, what would be the correct way to render an image (Resource) from an > InputStream? Right now I've got a very simple extension of the Resource > class (code below), but this is causing problems since InputStream is not > serializable and I'm keeping a reference to it. Thanks in advance. > > //CODE BEGINS > > import java.io.InputStream; > import org.apache.wicket.Resource; > import org.apache.wicket.util.resource.IResourceStream; > import org.apache.wicket.util.resource.AbstractResourceStream; > > public class InputStreamResource extends Resource { > > private class InputStreamResourceStream extends AbstractResourceStream { > > public InputStream getInputStream() { > return in; > } > > public void close() { > try { > in.close(); > } catch (Exception e) { > e.printStackTrace(); > } > } > } > > private InputStream in; > > public InputStreamResource(InputStream in) { > this.in = in; > } > > @Override > public IResourceStream getResourceStream() { > return new InputStreamResourceStream(); > } > > } > > //CODE ENDS > > > Edgar Merino > > --------------------------------------------------------------------- > 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]
