AnsweredAssumed Answered

Content link asking for alfresco credentials

Question asked by shiv on Nov 2, 2012
Hi

Im using cmis qury to fetch the properties of the documents and using content url to get the content stream of the document and its working fine
but the problem is if we use this url it is asking alfresco login details.our requirement is to directly download the file with out asking the alfresco credentials.
And the downloaded document comes with the file name as "content" in all the cases with respective extensions. But my requirement is to get the original file name .
Can u help in getting this resolved .

The code for link is as below:
public static final String getDocumentURL(final Document document, final Session session) {
    String link = null;
    try {
        Method loadLink = AbstractAtomPubService.class.getDeclaredMethod("loadLink",
            new Class[] { String.class, String.class, String.class, String.class });
       
        loadLink.setAccessible(true);
       
        link = (String) loadLink.invoke(session.getBinding().getObjectService(), session.getRepositoryInfo().getId(),
            document.getId(), AtomPubParser.LINK_REL_CONTENT, null);
    } catch (Exception e) {
       e.printStackTrace();
    }
    return link;
  }

Outcomes