Then you might want to use a resourcestream ? Something like:
IResourceStream resourceStream = new AttachmentResourceStream( new ByteArrayInputStream(item.getModelObject().getFile())); getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(resourceStream) { @Override public String getFileName() { return item.getModelObject().getName(); } }); static class AttachmentResourceStream extends AbstractResourceStream { private InputStream attachment; /** * @param attachment */ AttachmentResourceStream(InputStream attachment) { this.attachment = attachment; } /** * @see org.apache.wicket.util.resource.IResourceStream#close() */ @Override public void close() throws IOException { attachment.close(); } /** * @see org.apache.wicket.util.resource.IResourceStream#getInputStream() */ @Override public InputStream getInputStream() throws ResourceStreamNotFoundException { return attachment; } } ** Martin 2010/7/15 Jarosz Yohan <yohan.jar...@epfl.ch>: > Perhaps I have badly explained something. > my javascript files are not located in my webapps directory, but on the > filesystem > On Jul 15, 2010, at 6:31 PM, Jarosz Yohan wrote: > > In fact, this is not working too. > I think it because wicket couldn't find my javascript file. > when I give url (this file can be accessed via url also) it's working, but > not with a filesystem path > and I really need not to pass by filesytem... > > On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote: > > This is easier: > > response.renderJavascriptReference("/js/jquery.js"); > > > ** > Martin > > 2010/7/15 Jarosz Yohan <yohan.jar...@epfl.ch<mailto:yohan.jar...@epfl.ch>>: > Hello, > > I'm trying to load statatic js files. I 'm using in the init of the > application > > getResourceSettings().addResourceFolder("/somePath/"); > resourceSettings.setResourceStreamLocator(new RessourceLocator()); > > with > public class RessourceLocator extends ResourceStreamLocator{ > public RessourceLocator() {} > public IResourceStream locate(final Class<?> clazz, final String path) { > IResourceStream located = super.locate(clazz, trimFolders(path)); > if (located != null) {return located;} > return super.locate(clazz, path); > } > private String trimFolders(String path) { > return path.substring(path.lastIndexOf("/") + 1);} > } > > and in my Page I have > add(JavascriptPackageResource.getHeaderContribution("/myFile.js")); > and of course myFile.js located under /somePath" > > what am I missing? > > Yohan > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > users-unsubscr...@wicket.apache.org<mailto:users-unsubscr...@wicket.apache.org> > For additional commands, e-mail: > users-h...@wicket.apache.org<mailto:users-h...@wicket.apache.org> > > > Jarosz Yohan > Bioinformatics & Biostatistics Core Facility > EPFL School of Life Sciences > > EPFL SV PTECH PTBB > AAB 0 23 > Station 15 > 1015 Lausanne > Switzerland > > phone: [+41 21 69] 31439 > email: yohan.jar...@epfl.ch<mailto:yohan.jar...@epfl.ch> > > > > > Jarosz Yohan > Bioinformatics & Biostatistics Core Facility > EPFL School of Life Sciences > > EPFL SV PTECH PTBB > AAB 0 23 > Station 15 > 1015 Lausanne > Switzerland > > phone: [+41 21 69] 31439 > email: yohan.jar...@epfl.ch<mailto:yohan.jar...@epfl.ch> > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org