<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Image contentUrl to byte array in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27350#M11762</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about the following code?&lt;/P&gt;&lt;P&gt;I'm sorry that I don't know about groovy and grails.&lt;/P&gt;&lt;P&gt;I tried to write the example code by using the following sites.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://projects.spring.io/grails-data-mapping/rest-client/api/grails/plugins/rest/client/RestResponse.html" title="http://projects.spring.io/grails-data-mapping/rest-client/api/grails/plugins/rest/client/RestResponse.html" rel="nofollow noopener noreferrer"&gt;RestResponse (grails-datastore-rest-client 1.0.0.BUILD-SNAPSHOT API)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html" title="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html" rel="nofollow noopener noreferrer"&gt;ResponseEntity (Spring Framework 5.0.2.RELEASE API)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpEntity.html#getBody--" title="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpEntity.html#getBody--" rel="nofollow noopener noreferrer"&gt;HttpEntity (Spring Framework 5.0.2.RELEASE API)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; border: 0px; font-size: 9pt;"&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;import &lt;/SPAN&gt;grails.plugins.rest.client.RestBuilder&lt;BR /&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;import &lt;/SPAN&gt;grails.plugins.rest.client.RestResponse&lt;BR /&gt;&lt;BR /&gt;RestBuilder rest = &lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;new &lt;/SPAN&gt;RestBuilder()&lt;BR /&gt;&lt;PRE style="background-color: #2b2b2b; border: 0px; font-weight: inherit; font-size: 9pt;"&gt;RestResponse restResponse = rest.get(result[&lt;SPAN style="color: #6897bb; border: 0px; font-weight: inherit; font-size: 12px;"&gt;1&lt;/SPAN&gt;][&lt;SPAN style="color: #6a8759; border: 0px; font-weight: inherit; font-size: 12px;"&gt;'contentUrl'&lt;/SPAN&gt;]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt;auth &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; font-size: 12px;"&gt;username&lt;/SPAN&gt;,&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; font-size: 12px;"&gt;password &lt;BR /&gt;&lt;/SPAN&gt;}&lt;BR /&gt;&lt;PRE style="background-color: #2b2b2b; border: 0px; font-weight: inherit; font-size: 9pt;"&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;byte&lt;/SPAN&gt;[] png_image = restResponse.responseEntity.getBody().getBytes()&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Dec 2017 11:39:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-12-27T11:39:37Z</dc:date>
    <item>
      <title>Image contentUrl to byte array</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27347#M11759</link>
      <description>Hi,I'm using activiti 6.0 rest api and trying to save a process .png image as BLOB in my database.I run a rest get call to the image contentUrl (http://localhost:8080/activiti-rest/service/repository/deployments/1234/resourcedata/image.png)&amp;nbsp;present in my process resources:restResponse = rest.get(res</description>
      <pubDate>Tue, 26 Dec 2017 23:51:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27347#M11759</guid>
      <dc:creator>laurav</dc:creator>
      <dc:date>2017-12-26T23:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Image contentUrl to byte array</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27348#M11760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;What's r&lt;SPAN&gt;est client&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;library&lt;/SPAN&gt;&amp;nbsp;do you use in the following code?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;Java data type that you will receive depends on the implementation on the client side(Rest client &lt;SPAN&gt;library&lt;/SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; border: 0px; font-size: 9pt;"&gt;restResponse = rest.get(result[&lt;SPAN style="color: #6897bb; border: 0px; font-weight: inherit; font-size: 12px;"&gt;1&lt;/SPAN&gt;][&lt;SPAN style="color: #6a8759; border: 0px; font-weight: inherit; font-size: 12px;"&gt;'contentUrl'&lt;/SPAN&gt;]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt;auth &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; font-size: 12px;"&gt;username&lt;/SPAN&gt;,&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; font-size: 12px;"&gt;password &lt;BR /&gt;&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;P&gt;If now you receive it as InputStream, you can convert it to byte[] by the method of the following article.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/1264709/convert-inputstream-to-byte-array-in-java" title="https://stackoverflow.com/questions/1264709/convert-inputstream-to-byte-array-in-java" rel="nofollow noopener noreferrer"&gt;bytearray - Convert InputStream to byte array in Java - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2017 04:20:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27348#M11760</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-27T04:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Image contentUrl to byte array</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27349#M11761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for not mentioning this...I am using grails :&amp;nbsp;&lt;/P&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;grails.plugins.rest.client.RestBuilder&lt;BR /&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;grails.plugins.rest.client.RestResponse&lt;BR /&gt;&lt;BR /&gt;RestBuilder rest = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;RestBuilder()&lt;BR /&gt;&lt;PRE style="background-color: #2b2b2b; font-size: 9.0pt;"&gt;RestResponse restResponse = rest.get(result[&lt;SPAN style="color: #6897bb; border: 0px; font-weight: inherit; margin: 0px;"&gt;1&lt;/SPAN&gt;][&lt;SPAN style="color: #6a8759; border: 0px; font-weight: inherit; margin: 0px;"&gt;'contentUrl'&lt;/SPAN&gt;]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; margin: 0px;"&gt;auth &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; margin: 0px;"&gt;username&lt;/SPAN&gt;,&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; margin: 0px;"&gt;password &lt;BR /&gt;&lt;/SPAN&gt;}&lt;BR /&gt;&lt;SPAN style="color: #cc7832;"&gt;byte&lt;/SPAN&gt;[] png_image = IOUtils.copyToByteArray(restResponse)&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;And am getting this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No signature of method: static grails.io.IOUtils.copyToByteArray() is applicable for argument types: (grails.plugins.rest.client.RestResponse) values: [grails.plugins.rest.client.RestResponse@27a210e7]&lt;BR /&gt;Possible solutions: copyToByteArray(java.io.File), copyToByteArray(java.io.InputStream).&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2017 10:26:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27349#M11761</guid>
      <dc:creator>laurav</dc:creator>
      <dc:date>2017-12-27T10:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Image contentUrl to byte array</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27350#M11762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about the following code?&lt;/P&gt;&lt;P&gt;I'm sorry that I don't know about groovy and grails.&lt;/P&gt;&lt;P&gt;I tried to write the example code by using the following sites.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://projects.spring.io/grails-data-mapping/rest-client/api/grails/plugins/rest/client/RestResponse.html" title="http://projects.spring.io/grails-data-mapping/rest-client/api/grails/plugins/rest/client/RestResponse.html" rel="nofollow noopener noreferrer"&gt;RestResponse (grails-datastore-rest-client 1.0.0.BUILD-SNAPSHOT API)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html" title="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/ResponseEntity.html" rel="nofollow noopener noreferrer"&gt;ResponseEntity (Spring Framework 5.0.2.RELEASE API)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpEntity.html#getBody--" title="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpEntity.html#getBody--" rel="nofollow noopener noreferrer"&gt;HttpEntity (Spring Framework 5.0.2.RELEASE API)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE style="color: #a9b7c6; background-color: #2b2b2b; border: 0px; font-size: 9pt;"&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;import &lt;/SPAN&gt;grails.plugins.rest.client.RestBuilder&lt;BR /&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;import &lt;/SPAN&gt;grails.plugins.rest.client.RestResponse&lt;BR /&gt;&lt;BR /&gt;RestBuilder rest = &lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;new &lt;/SPAN&gt;RestBuilder()&lt;BR /&gt;&lt;PRE style="background-color: #2b2b2b; border: 0px; font-weight: inherit; font-size: 9pt;"&gt;RestResponse restResponse = rest.get(result[&lt;SPAN style="color: #6897bb; border: 0px; font-weight: inherit; font-size: 12px;"&gt;1&lt;/SPAN&gt;][&lt;SPAN style="color: #6a8759; border: 0px; font-weight: inherit; font-size: 12px;"&gt;'contentUrl'&lt;/SPAN&gt;]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt;auth &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; font-size: 12px;"&gt;username&lt;/SPAN&gt;,&lt;SPAN style="color: #9876aa; border: 0px; font-weight: inherit; font-size: 12px;"&gt;password &lt;BR /&gt;&lt;/SPAN&gt;}&lt;BR /&gt;&lt;PRE style="background-color: #2b2b2b; border: 0px; font-weight: inherit; font-size: 9pt;"&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 12px;"&gt;byte&lt;/SPAN&gt;[] png_image = restResponse.responseEntity.getBody().getBytes()&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Dec 2017 11:39:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/image-contenturl-to-byte-array/m-p/27350#M11762</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-27T11:39:37Z</dc:date>
    </item>
  </channel>
</rss>

