chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Danninger <sebastian.dannin...@googlemail.com>
Subject Re: CMIS - Alfresco and document link
Date Tue, 09 Aug 2011 08:18:41 GMT
If you are working servlet base you can try this snippet:

        // create session
        Session s = f.createSession(parameter);
        String objectid = request.getParameter("objectid");
        Document doc = (Document) s.getObject(s.createObjectId(objectid));
        String filename = doc.getName();
        String MIME = doc.getContentStreamMimeType();
        InputStream in = doc.getContentStream().getStream();
        response.setContentType(MIME);
        response.setHeader("Content-Disposition","attachment;filename=\"" +
filename + "\"");
        ServletOutputStream out = response.getOutputStream();
        byte[] outputByte = new byte[in.available()];

        int sizeRead = 0;

        while((sizeRead = in.read(outputByte, 0 , outputByte.length)) > 0) {
            out.write(outputByte, 0 , sizeRead);
        }

        in.close();
        out.flush();
        out.close();

otherwise you can build up the url urself:

http://localhost:8080/alfresco/webdav/FOLDER_STRUCTURE/DOCNAME

But I'd suggest to use sth like that:

http:/localhost:8080/alfresco/d/a/workspace/SpacesStore/NODEREF/DOCNAME

as your app has a session with the repo (atompub) you wont need your users
to authenticate with the repository again.

hope this solves your problems

all the best

Sebastian

2011/8/9 Reinhardt Willy <willyreinhardt@yahoo.fr>

> Hi,
>
> I am using CMIS with Apache Chemistry OpenCMIS 0.3.0-incubating-SNAPSHOT
> and
> Alfresco 3.4.d.
>
> How could I get document link(cifs, webdav) for a document using cmis
> properties
> or query ?
>
> I used workbench to see if an Alfresco extension contains that infos but I
> don't
> found it.
>
>
> I would get something like:
>
> http://localhost:8080/alfresco/webdav/t ... /2/my.docx
> or
> file:////test/test1/2011/2/my.docx
>
> Thanks for any advices.
>
>  Willy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message