AnsweredAssumed Answered

Web Content type: content or avmplaincontent?

Question asked by nathan on Aug 8, 2007
Latest reply on Nov 27, 2007 by robertoroberto
Hi all,

I need some help clarifying issues I'm seeing in a Web Services application. I am trying to access content in an XML file, and largely followed the examples in the SDK.

I've tried two methods of accessing this content, each with its own issue. First, I tried querying for the content using the normal alfresco content type:

Store storeRef = new Store("avm", "myWebProject");

Query query = new Query(

Predicate predicate = new Predicate(null, storeRef, query);

Content[] readResult =

if (readResult == null) {
               System.out.println("No content gotten!");
            else {
               for (Content content : readResult) {
                   InputStream contentStream = ContentUtils.getContentAsInputStream(content);


This seems to work without errors, but the readResult contains each piece of retrieved content six times, and continues to receive results from content that has been deleted.

After checking the node browser, I noticed that all the web content files are listed as type "{}avmplaincontent". Replacing the type in the read method, however, gives me this error:

org.alfresco.webservice.util.WebServiceException: Unable to get content as inputStream.
   at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(
   at com.bigbad.utils.HeadlineGrabber.getHeadlineList(
   at com.bigbad.utils.HeadlineGrabber.getHeadlines(
   at com.bigbad.utils.HeadlineGrabber.main(
Caused by: no protocol: null?ticket=TICKET_861ad1ef84ccfc8e68ad51787c1e5812ff219e41
   at<init>(Unknown Source)
   at<init>(Unknown Source)Error during query
   at<init>(Unknown Source)
   at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(
   … 3 more

After digging into the ContentUtils code, I tracked the problem down to a call to content.getURL(), which returns null and, in turn, the MalformedURLException above.

Any suggestions how I could make this work?