Yes I have. I tried to do something similar to get the version history from Guvnor, but then I get exceptions which seem to be related to REST API and not Guvnor. I have no idea why this is happening.
Code:
URL url = new URL(guvnorURI + "/" + packageName +"/"+"versions");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", MediaType.APPLICATION_ATOM_XML);
String userPassword = "admin" + ":" + "admin";
String encoding = new sun.misc.BASE64Encoder().encode(userPassword.getBytes());
con.setRequestProperty("Authorization", "Basic " + encoding);
con.connect();
InputStream versionHistory = con.getInputStream();
Abdera ab = new Abdera();
Document<Feed> doc = ab.getParser().parse(new InputStreamReader(versionHistory));
Feed feed = doc.getRoot();
List<Entry> entries = feed.getEntries();
for(Entry entry : entries){
System.out.println(entry.getTitle());
System.out.println(entry.getUpdated());
System.out.println(entry.getAuthor());
}
.
.
//remaining code.
Exception: thrown at Document<Feed> doc = ab.getParser().parse(new InputStreamReader(versionHistory));
Exception in thread "main" org.apache.abdera.parser.ParseException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:244)
at org.apache.abdera.parser.stax.FOMBuilder.getFomDocument(FOMBuilder.java:317)
at org.apache.abdera.parser.stax.FOMParser.getDocument(FOMParser.java:79)
at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:191)
at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:143)
at org.apache.abdera.util.AbstractParser.parse(AbstractParser.java:86)
at com.envisagesystems.rules.impl.TestRuleImpl.printVersionHistory(TestRuleImpl.java:66)
at com.envisagesystems.rules.impl.TestRuleImpl.main(TestRuleImpl.java:47)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.abdera.parser.stax.FOMBuilder.getNextElementToParse(FOMBuilder.java:149)
at org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:174)
... 7 more
Any ideas?
Aseem
Have you tried reading Guvnor's documentation?
There's a large section relating to REST calls.
On 24 January 2013 18:20, Aseem Belsare <aseem.belsare@gmail.com> wrote:_______________________________________________Hi,I wish to obtain the version history from Guvnor repository. Stumbled upon http://drools.46999.n3.nabble.com/Guvnor-Repository-Report-td3376667.html which seems to be related to the same topic, but the link in there is not working which points to the documentation for using REST API to get the assets/package version history info.Is there a way of doing it? I started working on Guvnor just recently and I've setup a simple rule and making changes to it to be saved in the Guvnor repo. I wish to pull the version history and generate a report using JAVA based off of it.Any help would be appreciated.Thanks,Aseem
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users