how to download document using download url in liferay?

和自甴很熟 提交于 2020-02-04 11:00:53

问题


I have developed a web service using service builder portlet, which will return a list of documents from Liferay (6.2 EE). I am returning the default document download URL like the following:

{
    ...
    "downloadUrl": "http://localhost:8080/documents/10181/12306/folder1_doc1/98188996-af04-41c8-b0b6-10b83bf17ee4"
}

When the client calls the web-service he is passing user name and password in header with basic authentication.

But when the client is trying to call the document URL with the same basic authentication Liferay returns a HTML page asking for login to access this document. How can I access the document without that login page?


回答1:


You will have to add the BasicAuthHeaderAutoLogin to the auto.login.hooks property for your portal.

For example add this to your portal-ext.properties:

auto.login.hooks=...copy line from WEB-INF/lib/portal-impl.jar/portal.properties...,\
    com.liferay.portal.security.auth.BasicAuthHeaderAutoLogin


来源:https://stackoverflow.com/questions/32522468/how-to-download-document-using-download-url-in-liferay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!