我正在尝试使用 wcm API 从 WCM 呈现富文本内容。我有jsp这样做。它为除匿名之外的所有用户组正确呈现。当我查看渲染的内容时,我在富文本中看到损坏的图像。当我登录并查看渲染的内容时,会显示图像。
这是我的代码:
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 输出时:显示文本但图像损坏