websphere-portalrichtextwcm

RichText rendering issue for anonymous users


I am trying to render richtext content from WCM using wcm API. I have jsp to do so. It renders properly for all user group except anonymous. When I view rendered content I see broken image inside richtext. When I log in and view the rendered content, image is displayed.

here is my code:

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 is outputs richtext with image for authorized users. When I logout and view s2 output: text is displayed but image is broken


Solution

  • Solution has nothing to do with access level in my case! I checked url of the content and in both cases it consisted /myconnect word (example: http:ip_address:port/wps/wcm/myconnect/...) I found out that myconnect is for authorized user and connect is for anon users. (example: http:ip_address:port/wps/wcm/connect/...) Just by replacing myconnect with connect in the url to the wcm content I managed to solve the problem: