You could use the WebDav server [1] (use the SimpleWebdavServlet) that comes with the jackrabbit-webapp to access the repository over Http/Webdav.
Or you could program your own servlet that reads the file data using the JCR API and provides it over HTTP. Regards, Alex [1] http://jackrabbit.apache.org/jackrabbit-jcr-server.html On Tue, Sep 30, 2008 at 4:42 AM, shrimpywu <[EMAIL PROTECTED]> wrote: > > question about how to provide download link after save file into JCR > > i wrote a function to save binary file, but after i save the file. how can > i get the file???????? > > [code] > public String saveFile(final File file, final String mimeType, final String > encoding, final User user) { > return (String) execute(new JcrCallback() { > > public Object doInJcr(Session session) throws IOException, > RepositoryException { > > checkUserFolder(user, session); > > Node root = session.getRootNode(); > > JcrConstants jcrConstants = new JcrConstants(session); > > //create the file node > Node fileNode = > root.getNode(USER_FOLDER_PREFIX).getNode(user.getUsername()).addNode(file.getName(), > jcrConstants.getNT_FILE()); > > //create the mandatory child node - jcr:content > Node resourseNode = > fileNode.addNode(jcrConstants.getJCR_CONTENT(), > jcrConstants.getNT_RESOURCE()); > > resourseNode.setProperty(jcrConstants.getJCR_MIMETYPE(), > mimeType); > resourseNode.setProperty(jcrConstants.getJCR_ENCODING(), > encoding); > resourseNode.setProperty(jcrConstants.getJCR_DATA(), new > FileInputStream(file)); > Calendar lastModified = Calendar.getInstance(); > lastModified.setTimeInMillis(file.lastModified()); > resourseNode.setProperty(jcrConstants.getJCR_LASTMODIFIED(), > lastModified); > > session.save(); > > > log.debug(resourseNode.getCorrespondingNodePath(session.getWorkspace().getName())); > return resourseNode.getPath(); > } > }); > } > [/code] > > Here is the bean i used to inject into spring. > [code] > <bean id="repository" > class="org.springmodules.jcr.jackrabbit.RepositoryFactoryBean"> > <property name="configuration" value="classpath:/repository.xml" /> > <property name="homeDir" value="file:./target/repo" /> > </bean> > [/code] > > -- > View this message in context: > http://www.nabble.com/question-about-how-to-provide-download-link-after-save-file-into-JCR-tp19735243p19735243.html > Sent from the Jackrabbit - Users mailing list archive at Nabble.com. > > -- Alexander Klimetschek [EMAIL PROTECTED]
