You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Dimitar Dimitrov <dd...@consult.bg> on 2012/08/29 15:20:10 UTC
Adobe flex based upload to Sling
Hello everyone.
I am trying to implement the file upload functionality to Sling from
Adobe Flex based client.
I tried all of the possibilities in the Flex FileReference.upload()
method but unsuccessfully. Then I saw that Flex client sends properties
of the request differently than the standard HTTP form.
The main issue is that I am trying to upload the file into the nt:folder
element and Slings returns the IOError event. After some investigations
I found that the Sling tries to create a property with name
"{}Filename", which is actually sent from the Adobe flash player. If I
try to upload a file into the nt:unstructured node everything is OK, but
the file did not stands as a nt:file. There is an another issue that can
produce IOError event. The Flash player in Firefox did not send the
authentication parameters from the cookie. There are some workarounds
that can fix this issue, so my problem is not in the authentication.
After that I decide to make a PUT call to the Sling, but it turned out
that the browser's flash player did not support PUT HTTP Request. So the
next step that I decide to do is to produce my own PostOperationServlet
which can do the actual nt:file creation from custom HTTP POST request.
I am almost done but just in case I decide to ask you about the other
possibility which can do the browser based Adobe Flex upload to Sling.
Thanks in advance.
Dimitar
Re: Adobe flex based upload to Sling
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Wed, Aug 29, 2012 at 9:20 AM, Dimitar Dimitrov <dd...@consult.bg> wrote:
> ...I decide to make a PUT call to the Sling, but it turned out that
> the browser's flash player did not support PUT HTTP Request.. So the next
> step that I decide to do is to produce my own PostOperationServlet which can
> do the actual nt:file creation from custom HTTP POST request...
Implementing a custom POST servlet, triggered by a .flash selector for
example, would work, and as you say you could also implement a custom
PostOperation if you can add the required :operation parameter on the
client side.
The best solution IMO, if you can set HTTP headers on the client side,
would be to implement (and contribute maybe) the filter described in
https://issues.apache.org/jira/browse/SLING-53 to morph a POST request
into a PUT that would then be handled by the existing code.
-Bertrand
Re: Adobe flex based upload to Sling
Posted by Oliver Lietz <ap...@oliverlietz.de>.
Am Friday, 5. October 2012 schrieb Dimitar Dimitrov:
> Hi guys.
hello Dimitar,
> I forgot to mention that I have successfully integrate Flex Upload with
> the Sling by using the as3httpclient as Oliver recommends.
> The main issue that I met after that was the sling.formauth cookie. But
> with the as3httpclient I managed to extract the cookie and everything
> works fine now.
> For now I am trying to implement Flex object persistence to JCR object
> in the repository, by using some kind of "Active Record" pattern. If I
> able to produce a working version I will commit it as an open source
> library.
I've done Flex/Magnolia, Flex/Sling and Flex/db4o persistence. ActionScript
(Object) to Java (Object) persistence mapping can be painful. I suggest
modeling your content (data) with Nodes and Properties in JCR and using JSON
or XML in Flex.
regards,
O.
> Thanks again.
> Dimitar.
>
Re: Adobe flex based upload to Sling
Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Oct 5, 2012 at 9:26 AM, Dimitar Dimitrov <dd...@consult.bg> wrote:
> ...For now I am trying to implement Flex object persistence to JCR object in
> the repository, by using some kind of "Active Record" pattern. If I able to
> produce a working version I will commit it as an open source library...
Cool - if you get that working, http://incubator.apache.org/flex/
might be interested in having it as an optional module.
-Bertrand
Re: Adobe flex based upload to Sling
Posted by Dimitar Dimitrov <dd...@consult.bg>.
Hi guys.
I forgot to mention that I have successfully integrate Flex Upload with
the Sling by using the as3httpclient as Oliver recommends.
The main issue that I met after that was the sling.formauth cookie. But
with the as3httpclient I managed to extract the cookie and everything
works fine now.
For now I am trying to implement Flex object persistence to JCR object
in the repository, by using some kind of "Active Record" pattern. If I
able to produce a working version I will commit it as an open source
library.
Thanks again.
Dimitar.
On 08/29/2012 11:37 PM, Oliver Lietz wrote:
> Am Wednesday, 29. August 2012 schrieb Dimitar Dimitrov:
>> Hello everyone.
> hello Dimitar,
>
>> I am trying to implement the file upload functionality to Sling from
>> Adobe Flex based client.
>> I tried all of the possibilities in the Flex FileReference.upload()
>> method but unsuccessfully. Then I saw that Flex client sends properties
>> of the request differently than the standard HTTP form.
>> The main issue is that I am trying to upload the file into the nt:folder
>> element and Slings returns the IOError event. After some investigations
>> I found that the Sling tries to create a property with name
>> "{}Filename", which is actually sent from the Adobe flash player. If I
>> try to upload a file into the nt:unstructured node everything is OK, but
>> the file did not stands as a nt:file. There is an another issue that can
>> produce IOError event. The Flash player in Firefox did not send the
>> authentication parameters from the cookie. There are some workarounds
>> that can fix this issue, so my problem is not in the authentication.
>> After that I decide to make a PUT call to the Sling, but it turned out
>> that the browser's flash player did not support PUT HTTP Request. So the
>> next step that I decide to do is to produce my own PostOperationServlet
>> which can do the actual nt:file creation from custom HTTP POST request.
>> I am almost done but just in case I decide to ask you about the other
>> possibility which can do the browser based Adobe Flex upload to Sling.
> use as3httpclient[1] instead. I was able to successfully POST files to Sling.
>
> regards,
> O.
>
>> Thanks in advance.
>> Dimitar
> [1] https://github.com/gabriel/as3httpclient
Re: Adobe flex based upload to Sling
Posted by Oliver Lietz <ap...@oliverlietz.de>.
Am Wednesday, 29. August 2012 schrieb Dimitar Dimitrov:
> Hello everyone.
hello Dimitar,
> I am trying to implement the file upload functionality to Sling from
> Adobe Flex based client.
> I tried all of the possibilities in the Flex FileReference.upload()
> method but unsuccessfully. Then I saw that Flex client sends properties
> of the request differently than the standard HTTP form.
> The main issue is that I am trying to upload the file into the nt:folder
> element and Slings returns the IOError event. After some investigations
> I found that the Sling tries to create a property with name
> "{}Filename", which is actually sent from the Adobe flash player. If I
> try to upload a file into the nt:unstructured node everything is OK, but
> the file did not stands as a nt:file. There is an another issue that can
> produce IOError event. The Flash player in Firefox did not send the
> authentication parameters from the cookie. There are some workarounds
> that can fix this issue, so my problem is not in the authentication.
> After that I decide to make a PUT call to the Sling, but it turned out
> that the browser's flash player did not support PUT HTTP Request. So the
> next step that I decide to do is to produce my own PostOperationServlet
> which can do the actual nt:file creation from custom HTTP POST request.
> I am almost done but just in case I decide to ask you about the other
> possibility which can do the browser based Adobe Flex upload to Sling.
use as3httpclient[1] instead. I was able to successfully POST files to Sling.
regards,
O.
> Thanks in advance.
> Dimitar
[1] https://github.com/gabriel/as3httpclient