Domanda

The cloud storage services like Google and Box have a shareable url endpoint for all files. Something like http://drive.google.com/my-object-id.

Is there a default cmis value across most server implementations to get this kind of url? If not what is the name of this property for Alfresco?

È stato utile?

Soluzione

CMIS is an industry standard for Enterprise Content Management (ECM) repositories. Alfresco is compliant with both CMIS 1.0 and CMIS 1.1. CMIS 1.0 supports two bindings, one on SOAP and the other on the Atom Publishing Protocol. In CMIS 1.1 a new "binding" was added called the browser binding.

The answer to your question depends on which binding you are using.

Browser Binding

Using the browser binding, you POST HTML forms to create new objects and when you issue GETs you get JSON back.

In CMIS 1.0, the URL structure was completely dependent on the underlying repository. With the CMIS 1.1 browser binding, the URL structure is dictated by the spec.

For example, in Alfresco 4.2.x, the "service URL" for the CMIS 1.1 browser binding is:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser

Everything below that is based on the spec. So if I want to get JSON back that lists the objects in a folder residing under "/test" I would do:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/test

And, to your original question, if I want an object and I know its object ID I can use:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root?objectId=f5681ba1-a4da-4183-82be-8f1869d7310d;3.0

Which returns the object itself, or:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root?objectId=f5681ba1-a4da-4183-82be-8f1869d7310d;3.0&cmisselector=object

If you want the metadata about the object.

So, when you use the CMIS browser binding, you don't need a property to tell you the URL of the object, you just need the service URL and the object's object ID.

AtomPub Binding

If you are using the AtomPub binding, the URL structure is not defined by the spec, it is defined by the repository. So there is no standard way to retrieve content via URL across different CMIS servers when you are using the Atom Pub binding.

However, the "content URL" for a given piece of content is returned as part of the Atom Entry for a piece of content. You'll find it in the src attribute of the atom:content element.

For example, using curl or something similar running against Alfresco 4.2.f, I can fetch the atom entry for a piece of content using its ID, like this:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/entry?id=f5681ba1-a4da-4183-82be-8f1869d7310d%3B3.0

Looking at the XML that comes back, I see this:

<atom:content src="http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom/content/test.txt?id=f5681ba1-a4da-4183-82be-8f1869d7310d%3B3.0" type="text/plain"/>

So I can go directly to this URL to retrieve the content.

So if you can get to the Atom response you can grab this value and you'll have your URL. However, be aware that if end-users invoke this URL, they'll be prompted for Alfresco credentials over basic auth. If that doesn't work for you you'll have to write a proxy to fetch the content and stream it back to the user.

Altri suggerimenti

if you go to: Alfresco CMIS with

user=admin and password=admin

you'll be able to see (eg. Root Collection) a list of files and their relative sharable URL. The CMIS interface is also available in your local Alfresco instance, so you should be able to check it there. Hope it helps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top