<?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: Streaming upload with Alfresco API in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296183#M249313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'am sorry I 'am very clear about what you are up to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to implement a Java BackedWebscript for alfresco and you file is already uploaded to your alfresco server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the code you paste will just work&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or you can just use &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt; ContentWriter.putContent(File file)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;method&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If&amp;nbsp; you want to implement a Java BackedWebscript for share ,you file is already uploaded to your share server,and you want to upload it to alfresco server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you can call the inbed&amp;nbsp; /alfresco/service/api/upload api.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 May 2014 12:52:55 GMT</pubDate>
    <dc:creator>kaynezhang</dc:creator>
    <dc:date>2014-05-19T12:52:55Z</dc:date>
    <item>
      <title>Streaming upload with Alfresco API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296178#M249308</link>
      <description>Hi,I'm implementing a Java BackedWebscript. I need to upload a large file to an Alfresco node. I see this class: UploadContentServlet, but I don't know if work fine for large files or better do it with another class.I see also the code of this class, but I don't find examples using it. Only REST cal</description>
      <pubDate>Wed, 07 May 2014 14:56:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296178#M249308</guid>
      <dc:creator>spilby</dc:creator>
      <dc:date>2014-05-07T14:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Streaming upload with Alfresco API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296179#M249309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The trick with writing Java web script controllers for streaming is the following annotation which gives you control over the stream rather than the contents being buffered &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; by the framework.&amp;nbsp;&amp;nbsp; Look for scripts that define this.&amp;nbsp; If you already have the content then just use the Java API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;!–&amp;nbsp; turn off the multipart formdata processing –&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;formdata multipart-processing="false" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 15:40:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296179#M249309</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2014-05-07T15:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Streaming upload with Alfresco API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296180#M249310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, I&amp;nbsp; dont understand. Where I need to put this script? The formdata multipart procesing. I only have a java backed webscript, the document to upload is in a directory and I know the path. I dont have forms in html or javascript. Only my java webscript class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copy this code from the uploadservlet. Is all that I need to do to put the content with streaming to a noderef? Or Im wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ServiceRegistry serviceRegistry = getServiceRegistry(getServletContext());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ContentService contentService = serviceRegistry.getContentService();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MimetypeService mimetypeService = serviceRegistry.getMimetypeService();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;InputStream is = req.getInputStream();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BufferedInputStream inputStream = new BufferedInputStream(is);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Try and get the content writer ContentWriter writer = contentService.getWriter(nodeRef, propertyQName, true); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // Set the mimetype and encoding writer.setMimetype(mimetype); writer.setEncoding(encoding); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Stream the content into the repository&amp;nbsp; writer.putContent(inputStream);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A lot of users may use this webscript at the same time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;putContent put the content with streaming? No problems if the content is very big? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 17:27:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296180#M249310</guid>
      <dc:creator>spilby</dc:creator>
      <dc:date>2014-05-07T17:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Streaming upload with Alfresco API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296181#M249311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BR /&gt;&lt;SPAN&gt;You need to put the script into&amp;nbsp; the description xml file of the webscript you want to implemente&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;webscript&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;shortname&amp;gt;your webscript name&amp;lt;/shortname&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;description&amp;gt;…..&amp;lt;/description&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;….&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;lt;!–&amp;nbsp; turn off the multipart formdata processing –&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;formdata multipart-processing="false" /&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/webscript&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your java backed webscript,you should do following steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1.parse the mutipart form&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.get the input stream&amp;nbsp; from mutipart form&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.get the content writer for a node&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.put content stream into it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 07:15:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296181#M249311</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-05-09T07:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Streaming upload with Alfresco API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296182#M249312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem is: I have the document to upload in a path that an applications puts in before. I don't have form. I just read the path in my java backed webscript and read the archive. In this case, I suppose that the formdata multipart-profesing has no effect. It's ok? How can I upload with streaming in this case?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FileInputStream fis = new FileInputStream( path );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BufferedInputStream inputStream= new BufferedInputStream(fis);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ContentWriter writer = getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;writer.putContent(inputStream);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 08:00:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296182#M249312</guid>
      <dc:creator>spilby</dc:creator>
      <dc:date>2014-05-19T08:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Streaming upload with Alfresco API</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296183#M249313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'am sorry I 'am very clear about what you are up to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to implement a Java BackedWebscript for alfresco and you file is already uploaded to your alfresco server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the code you paste will just work&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or you can just use &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt; ContentWriter.putContent(File file)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;method&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If&amp;nbsp; you want to implement a Java BackedWebscript for share ,you file is already uploaded to your share server,and you want to upload it to alfresco server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you can call the inbed&amp;nbsp; /alfresco/service/api/upload api.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 12:52:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/streaming-upload-with-alfresco-api/m-p/296183#M249313</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-05-19T12:52:55Z</dc:date>
    </item>
  </channel>
</rss>

