我想從WCM使用wcm API呈現richtext內容。我有jsp要這樣做。它適用於除匿名以外的所有用戶組。當我查看渲染的內容時,我在richtext中看到了破碎的圖像。當我登錄並查看渲染內容時,會顯示圖像。匿名用戶的RichText呈現問題
這裏是我的代碼:
Workspace ws = WCM_API.getRepository().getSystemWorkspace();
ws.login();
DocumentLibrary lib = ws.getDocumentLibrary("Portal Site");
String s1 = "";
String s2 = "";
if (lib!=null) {
DocumentIdIterator<Document> it = ws.findByName(DocumentTypes.Content,"kino");
if (it.hasNext()) {
DocumentId<Document> docid = it.next();
Content doc = (Content) ws.getById(docid);
s1 = "Title: " + doc.getTitle() + "\n";
RichTextComponent c = (RichTextComponent) doc.getComponent("Body");
s2 = "Text: " + c.getRichText();
}
}
out.println(s1);
out.println(s2);
S2是輸出與授權用戶圖像的富文本。 當我註銷並查看s2輸出時:顯示文本,但圖像中斷
我已經嘗試過useUserAccess(true)以及使用LiveAccess(true),但兩者似乎都不適用於我的情況。但無論如何感謝您的建議 –
訪問權限呢?您的富文本是否授予了用戶訪問權限? –
我可以設置貢獻者訪問anon用戶,但它不安全(不會被允許這樣做)。但我試過在測試服務器上,它有幫助。 –