I came across this post which seems to be pretty much what I need:

http://www.nabble.com/For-a-Flash-element%3A-Need-manual-access-to-repository-td6185443.html#a6206233

but I get stuck while following it. I am attempting to create a servlet
which when called will return the given page content. So I will pass in
'index' and get back the content of the page 'index'. So far I have this
which seems to work:

WebContext webContext = (WebContext)
FactoryUtil.newInstance(WebContext.class);
webContext.init(request , response ,
request.getSession().getServletContext());
MgnlContext.setInstance(webContext);
HierarchyManager websiteHierarchy =
webContext.getHierarchyManager("website");
Content contentIndex = websiteHierarchy.getContent("/index");
System.out.println("title [" + contentIndex.getTitle() +"]");

and I get back the title correctly. What I would now like to do is retrieve
the rest of the page content. I have been trying this:

Iterator cCollectionIterator = ((Content)
contentIndex.getContent("prosocTextImage")).getChildren().iterator();
while (cCollectionIterator.hasNext()) {
        Content tmp = (Content) cCollectionIterator.next();
        contentString += tmp.getNodeData("contentParagraph").getString();
        System.out.println("contentString [" + contentString +"]");
}

'prosocTextImage' is the name of a paragraph but as I am really not sure
what I should be passing in here I am getting an error:

javax.jcr.PathNotFoundException: prosocTextImage

Can anyone help me out please?
-- 
View this message in context: 
http://www.nabble.com/Read-data-from-repo-tp24596835p24596835.html
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to