If you want to store files to Guvnor using its rest api here is an example:
URL createServiceNodeIconURL = new URL(packageAssetsURL);
HttpURLConnection createServiceNodeIconConnection = (HttpURLConnection) createServiceNodeIconURL
.openConnection();
applyAuth(profile, createServiceNodeIconConnection);
createServiceNodeIconConnection.setRequestMethod("POST");
createServiceNodeIconConnection.setRequestProperty("Content-Type",
"application/octet-stream");
createServiceNodeIconConnection.setRequestProperty("Accept",
"application/atom+xml");
createServiceNodeIconConnection.setRequestProperty("Slug", "defaultservicenodeicon.png");
createServiceNodeIconConnection.setDoOutput(true);
createServiceNodeIconConnection.getOutputStream().write(getBytesFromFile(new File(default_servicenodeicon)));
createServiceNodeIconConnection.connect();
System.out.println("created service node icon: " + createServiceNodeIconConnection.getResponseCode());
Where packageAssetsURL if you are working in a package named "somePackage" could be localhost:8080/drools-guvnor/rest/packages/somePackage/assets. To store files you have to use the "Slug" header to tell Guvnor what the name of your asset it. Note that you should check if this asset exists first and delete it before storing a new one.
Hope this helps.