Hi guys, I have a question about creating new assets in Guvnor via rest
api, specifically on how to set the file extension of the new asset.
My code is simple:
URL createURL = new URL(packageAssetsURL); // example url:
http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/M...
HttpURLConnection createConnection = (HttpURLConnection)
createURL.openConnection();
applyAuth(profile, createConnection);
createConnection.setRequestMethod("POST");
createConnection.setRequestProperty("Content-Type",
"application/octet-stream");
createConnection.setRequestProperty("Accept",
"application/atom+xml");
createConnection.setRequestProperty("Slug", assetName); // assetName is
for example MyImage
createConnection.setDoOutput(true);
// apache batik streams the png image data
PNGTranscoder t = new PNGTranscoder();
TranscoderInput input = new TranscoderInput(new StringReader(svg));
TranscoderOutput output = new
TranscoderOutput(createConnection.getOutputStream());
t.transcode(input, output);
The MyImage asset gets created fine in Guvnor under defaultPackage, but
the file extension is .txt and not .png
If I specify the file extension in the "Slug" request property the file
created is for example MyImage.png.txt.
Is there any request property or anything else I need to set on the
connection to tell guvnor the actual file extension of the new asset??
Any input is much welcome.
Thanks.