Using the following code, I can fetch the packages from Guvnor using Rest API (source) but How can I next create a KnowledgeBuilder based on the source of Packages retrieved ?
My idea is to use ResourceFactory.
// Fetch Packages from Guvnor
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization",
"Basic " + new Base64().encodeToString(("admin:admin".getBytes())));
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", MediaType.WILDCARD);
connection.connect();
System.out.println("ResponseCode: " + connection.getResponseCode());
System.out.println("MediaType: " + connection.getContentType());
String packages = IOUtils.toString(connection.getInputStream());
InputStream is = connection.getInputStream();
Regards,
--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)