I am trying to parse the response atom feed received from websphere portal after rest call using apache abdera. However receiving the below error when parsing. Could some one let me know what the issue is?
org.apache.abdera.parser.stax.FOMUnsupportedTextTypeException: Unsupported Text Type: text/html
Abdera abdera = new Abdera();
AbderaClient abderaClient = new AbderaClient(abdera);
Factory factory = abdera.getFactory();
Cookie[] cookies=request.getCookies();
org.apache.commons.httpclient.Cookie ltpaCookieHttpCommons = new org.apache.commons.httpclient.Cookie();
RequestOptions options = new RequestOptions(true);
List<String> cookieStrings = new ArrayList<String>();
options.setHeader("Cookie", (String[])cookieStrings.toArray(new String[cookieStrings.size()]));
ClientResponse resp = abderaClient.get("http://localhost:10039/wps/contenthandler/!ut/p/digest!W9TQFjuU7ADCwtSkxDsxHg/searchfeed/search?queryLang=en&locale=en&resultLang=en&query=test&scope=com.ibm.lotus.search.ALL_SOURCES&start=0&results=10&output=application/xml", options);
System.out.println(resp.getType());
if (resp.getType() == ResponseType.SUCCESS) {
System.out.println("!!!!!!Response success!!!!!!");
Document<Feed> docFeed = resp.getDocument();
// JSON Output
Writer writer = abdera.getWriterFactory().getWriter("json");
try {
Feed feed=docFeed.getRoot();
abdera.getWriterFactory().getWriter("json").writeTo(feed, System.out);
} catch(Exception e) {
e.printStackTrace();
}
} else {
}
The issue is that the atom feed your parsing has a type tag with
text/html
in it which isn't in the atom spec so abdera throws the above error.According to the spec:
Are you sure the feed is an atom feed and not an RSS feed which supports enclosures with MIME types like the one above ?