Hi yerbol777,
I implemented following method to get the image via Activiti-REST-API:
<java>
public InputStream invokeGetInputStream()
{
HttpGet getMethod = new HttpGet( buildURI() );
CloseableHttpResponse httpResponse = null;
try
{
httpResponse = httpClient.execute( getMethod );
final HttpEntity responseEntity = httpResponse.getEntity();
int statusCode = httpResponse.getStatusLine().getStatusCode();
if( statusCode == HttpStatus.SC_OK )
{
InputStream content = IOUtils.toBufferedInputStream( responseEntity.getContent() );
return content;
}
return null;
}
catch( Exception e )
{
throw new MyOwnException( e );
}
finally
{
HttpClientUtils.closeQuietly( httpResponse );
}
}
</java>
Then save the InputStream to a file:
<java>
{
InputStream bufferedInputStream = IOUtils.toBufferedInputStream( inputStream );
byte [] byteArray = IOUtils.toByteArray( bufferedInputStream );
InputStream temp1 = new ByteArrayInputStream( byteArray );
String selectedTestType = (String)getComboBoxTestType().getSelectedItem();
File imgFile = new File( environmentConfig.getTestOutputsFile().getAbsolutePath(),
( selectedTestType + "." +
userTaskThread.getCurentTaskDefinitionKey() +
".jpg" ) );
FileUtils.copyInputStreamToFile( temp1, imgFile );
temp1.close();
}
</java>