You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Peter Svensson <ps...@gmail.com> on 2008/02/11 19:12:13 UTC

Bunkai coming closer

Hi,

I'm now able to create new nodes and subnodes in the Sling hierarchy with
bunkai. I'm now trying to load and save the 'contents' of each node, but I
can't seem to figure out what to call the form property.
Could someone help me out on this? I've tried to read Bertrands 15  minute
intro, but I'm not sure what the content property for a form could be.

Thanks for any help

Cheers,
PS

Re: Bunkai coming closer

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Thu, Feb 14, 2008 at 5:13 PM, Lars Trieloff <la...@trieloff.net> wrote:

> ... I think in theory it should be possible to send a PUT requests with the
>  body of the resource to the appropriate URL. I do not know how the
>  default servlet handles this now, but this might be easier to do than
>  doing some multipart tricks...

The default servlet does not handle PUT but the WebDAV servlet does.
There's an example at
http://incubator.apache.org/sling/site/discover-sling-in-15-minutes.html

-Bertrand

Re: Bunkai coming closer

Posted by Lars Trieloff <la...@trieloff.net>.
Hi Peter,

I think in theory it should be possible to send a PUT requests with the
body of the resource to the appropriate URL. I do not know how the
default servlet handles this now, but this might be easier to do than
doing some multipart tricks.

regards,

Lars

Btw. I am installing Bunkai right now.


On Wed, 2008-02-13 at 20:23 +0100, Peter Svensson wrote:
> But I think that I can get it going now, with the correctly named parameter.
> I did some digging and Dojo have a very nice content: {} parameter for
> setting 'form' data ina  apost on the fly, so I'll use that ^-^
> 
> I hope I have time tomorrow to finish a version that can be used for generic
> editing... for a given value of generic, of course..
> 
> Cheers,
> PS
> 
> On Feb 13, 2008 8:19 PM, Alexander Klimetschek <ak...@day.com> wrote:
> 
> > Ups, my last mail was nonsense regarding the XHR upload. You can't do
> > that without iframe or swf tricks. Thanks for correcting me!
> >
> > Alex
> >
> > Am 13.02.2008 um 17:26 schrieb Alexander Klimetschek:
> >
> > > Am 12.02.2008 um 21:51 schrieb Tobias Bocanegra:
> > >> i don't know dojo, but afaik in ajax you cannot send a file unless
> > >> you
> > >> loosen some browser security policies. a work around is to use a
> > >> hidden iframe that contains a form.
> > >
> > >
> > > You can send a form with an <input type="file"> via XHR, but you
> > > cannot set the filename via Javascript. The user must click the
> > > "browse" button and choose a file himself to avoid automatic
> > > uploading of critical files.
> > >
> > > Alex
> > >
> > > --
> > > Alexander Klimetschek
> > > alexander.klimetschek@day.com
> > >
> > >
> > >
> > >
> >
> > --
> > Alexander Klimetschek
> > alexander.klimetschek@day.com
> >
> >
> >
> >
> >


Re: Bunkai coming closer

Posted by Peter Svensson <ps...@gmail.com>.
But I think that I can get it going now, with the correctly named parameter.
I did some digging and Dojo have a very nice content: {} parameter for
setting 'form' data ina  apost on the fly, so I'll use that ^-^

I hope I have time tomorrow to finish a version that can be used for generic
editing... for a given value of generic, of course..

Cheers,
PS

On Feb 13, 2008 8:19 PM, Alexander Klimetschek <ak...@day.com> wrote:

> Ups, my last mail was nonsense regarding the XHR upload. You can't do
> that without iframe or swf tricks. Thanks for correcting me!
>
> Alex
>
> Am 13.02.2008 um 17:26 schrieb Alexander Klimetschek:
>
> > Am 12.02.2008 um 21:51 schrieb Tobias Bocanegra:
> >> i don't know dojo, but afaik in ajax you cannot send a file unless
> >> you
> >> loosen some browser security policies. a work around is to use a
> >> hidden iframe that contains a form.
> >
> >
> > You can send a form with an <input type="file"> via XHR, but you
> > cannot set the filename via Javascript. The user must click the
> > "browse" button and choose a file himself to avoid automatic
> > uploading of critical files.
> >
> > Alex
> >
> > --
> > Alexander Klimetschek
> > alexander.klimetschek@day.com
> >
> >
> >
> >
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>
>
>
>
>

Re: Bunkai coming closer

Posted by Alexander Klimetschek <ak...@day.com>.
Ups, my last mail was nonsense regarding the XHR upload. You can't do  
that without iframe or swf tricks. Thanks for correcting me!

Alex

Am 13.02.2008 um 17:26 schrieb Alexander Klimetschek:

> Am 12.02.2008 um 21:51 schrieb Tobias Bocanegra:
>> i don't know dojo, but afaik in ajax you cannot send a file unless  
>> you
>> loosen some browser security policies. a work around is to use a
>> hidden iframe that contains a form.
>
>
> You can send a form with an <input type="file"> via XHR, but you  
> cannot set the filename via Javascript. The user must click the  
> "browse" button and choose a file himself to avoid automatic  
> uploading of critical files.
>
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>
>
>
>

--
Alexander Klimetschek
alexander.klimetschek@day.com





Re: Bunkai coming closer

Posted by Alexander Klimetschek <ak...@day.com>.
Am 12.02.2008 um 21:51 schrieb Tobias Bocanegra:
> i don't know dojo, but afaik in ajax you cannot send a file unless you
> loosen some browser security policies. a work around is to use a
> hidden iframe that contains a form.


You can send a form with an <input type="file"> via XHR, but you  
cannot set the filename via Javascript. The user must click the  
"browse" button and choose a file himself to avoid automatic uploading  
of critical files.

Alex

--
Alexander Klimetschek
alexander.klimetschek@day.com





Re: Bunkai coming closer

Posted by Tobias Bocanegra <to...@day.com>.
> Maybe this will work out anyway, because I can create the nodes with
> required type from the bunkai tree right now.
> If I then fill the content of the node in a form field with the name
> "jcr:data", it should work, shouldn't it?
yes. this should work.
regards, toby

>
> Cheers,
> PS
>
> On Feb 12, 2008 9:51 PM, Tobias Bocanegra <to...@day.com> wrote:
>
> > > Hmm. The easiest way would of course be to send the content as jcr:data.
> > > How far away is the implementation of this, do you think?
> > i haven't tried this, but it should work. if you are dealing with text
> > anyways you just need to
> > ensure that you POST in utf-8. as long as the 'files' are already
> > there, this should work. the problem
> > would be to create new ones (currently). i'll create an issue to address
> > this.
> >
> > > Also, if not, how do I simulate multipart posting from Dojo? Hmm. I'll
> > go
> > > down in the dark documentation cellars..
> > i don't know dojo, but afaik in ajax you cannot send a file unless you
> > loosen some browser security policies. a work around is to use a
> > hidden iframe that contains a form.
> >
> > regards, toby
> > --
> > -----------------------------------------< tobias.bocanegra@day.com >---
> > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> > T +41 61 226 98 98, F +41 61 226 98 97
> > -----------------------------------------------< http://www.day.com >---
> >
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Bunkai coming closer

Posted by Peter Svensson <ps...@gmail.com>.
Hi Toby,

Maybe this will work out anyway, because I can create the nodes with
required type from the bunkai tree right now.
If I then fill the content of the node in a form field with the name
"jcr:data", it should work, shouldn't it?

Cheers,
PS

On Feb 12, 2008 9:51 PM, Tobias Bocanegra <to...@day.com> wrote:

> > Hmm. The easiest way would of course be to send the content as jcr:data.
> > How far away is the implementation of this, do you think?
> i haven't tried this, but it should work. if you are dealing with text
> anyways you just need to
> ensure that you POST in utf-8. as long as the 'files' are already
> there, this should work. the problem
> would be to create new ones (currently). i'll create an issue to address
> this.
>
> > Also, if not, how do I simulate multipart posting from Dojo? Hmm. I'll
> go
> > down in the dark documentation cellars..
> i don't know dojo, but afaik in ajax you cannot send a file unless you
> loosen some browser security policies. a work around is to use a
> hidden iframe that contains a form.
>
> regards, toby
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
>

Re: Bunkai coming closer

Posted by Tobias Bocanegra <to...@day.com>.
> Hmm. The easiest way would of course be to send the content as jcr:data.
> How far away is the implementation of this, do you think?
i haven't tried this, but it should work. if you are dealing with text
anyways you just need to
ensure that you POST in utf-8. as long as the 'files' are already
there, this should work. the problem
would be to create new ones (currently). i'll create an issue to address this.

> Also, if not, how do I simulate multipart posting from Dojo? Hmm. I'll go
> down in the dark documentation cellars..
i don't know dojo, but afaik in ajax you cannot send a file unless you
loosen some browser security policies. a work around is to use a
hidden iframe that contains a form.

regards, toby
-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Bunkai coming closer

Posted by Peter Svensson <ps...@gmail.com>.
Hmm. The easiest way would of course be to send the content as jcr:data.
How far away is the implementation of this, do you think?

Also, if not, how do I simulate multipart posting from Dojo? Hmm. I'll go
down in the dark documentation cellars..

Cheers,
PS

On Feb 11, 2008 10:44 PM, Peter Svensson <ps...@gmail.com> wrote:

> Thanks Tobias! Actually, I already rely on one script to get the Sling
> resource hierarchy out in the way I like :)
> But since I think Bunkai (the editor and hopefully Sling browser) will be
> egared at editing web content in Sling nodes, the basic file thin is
> probably the way to go.
> Great. I'll have to go sleep now, but I'll do it tomorrow.
>
> Cheers,
> PS
>
>
> On Feb 11, 2008 10:38 PM, Tobias Bocanegra <to...@day.com>
> wrote:
>
> > ok, there are several posibilities:
> > 1) you create a node with some property, eg: 'content'. but then you
> > need a html.esp script to dump the 'content' out again.
> > 2) you create a 'nt:file' node and store the content in the jcr:data
> > property. but this is not possible currently, since you can't define
> > the nodetype, yet).
> > 3) you upload a file in a multipart post. the post servlet will
> > automatically create a nt:file or nt:resource node and store the
> > content in the jcr:data property. after that you should be able to
> > address the content directly.
> >
> > hope this helps,
> > regards, toby
> >
> >
> > On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> > > Hmm. OK. That makes sense. but at the moment I'm trying to use the
> > nodes as
> > > if they were files. Is there a magic property for 'content'?
> > > Or, wait, maybe I can use any property name at all, as long as I use
> > the
> > > same all the time?
> > >
> > > But if I try to save contents of files (html files) using a property
> > > 'content'. How will they look when accessed as .html? I really don't
> > think
> > > I've understood things :| :)
> > >
> > > Cheers,
> > > PS
> > >
> > > On Feb 11, 2008 10:04 PM, Tobias Bocanegra <to...@day.com>
> > wrote:
> > >
> > > > hi,
> > > > you just give the input field of the form the same name as the
> > > > property you want to save.
> > > > regards, toby
> > > >
> > > > On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > I'm now able to create new nodes and subnodes in the Sling
> > hierarchy
> > > > with
> > > > > bunkai. I'm now trying to load and save the 'contents' of each
> > node, but
> > > > I
> > > > > can't seem to figure out what to call the form property.
> > > > > Could someone help me out on this? I've tried to read Bertrands 15
> > > >  minute
> > > > > intro, but I'm not sure what the content property for a form could
> > be.
> > > > >
> > > > > Thanks for any help
> > > > >
> > > > > Cheers,
> > > > > PS
> > > > >
> > > >
> > > >
> > > > --
> > > > -----------------------------------------< tobias.bocanegra@day.com>---
> > > > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001
> > Basel
> > > > T +41 61 226 98 98, F +41 61 226 98 97
> > > > -----------------------------------------------< http://www.day.com>---
> > > >
> > >
> >
> >
> > --
> > -----------------------------------------< tobias.bocanegra@day.com >---
> > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> > T +41 61 226 98 98, F +41 61 226 98 97
> > -----------------------------------------------< http://www.day.com >---
> >
>
>

Re: Bunkai coming closer

Posted by Peter Svensson <ps...@gmail.com>.
Thanks Tobias! Actually, I already rely on one script to get the Sling
resource hierarchy out in the way I like :)
But since I think Bunkai (the editor and hopefully Sling browser) will be
egared at editing web content in Sling nodes, the basic file thin is
probably the way to go.
Great. I'll have to go sleep now, but I'll do it tomorrow.

Cheers,
PS

On Feb 11, 2008 10:38 PM, Tobias Bocanegra <to...@day.com> wrote:

> ok, there are several posibilities:
> 1) you create a node with some property, eg: 'content'. but then you
> need a html.esp script to dump the 'content' out again.
> 2) you create a 'nt:file' node and store the content in the jcr:data
> property. but this is not possible currently, since you can't define
> the nodetype, yet).
> 3) you upload a file in a multipart post. the post servlet will
> automatically create a nt:file or nt:resource node and store the
> content in the jcr:data property. after that you should be able to
> address the content directly.
>
> hope this helps,
> regards, toby
>
>
> On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> > Hmm. OK. That makes sense. but at the moment I'm trying to use the nodes
> as
> > if they were files. Is there a magic property for 'content'?
> > Or, wait, maybe I can use any property name at all, as long as I use the
> > same all the time?
> >
> > But if I try to save contents of files (html files) using a property
> > 'content'. How will they look when accessed as .html? I really don't
> think
> > I've understood things :| :)
> >
> > Cheers,
> > PS
> >
> > On Feb 11, 2008 10:04 PM, Tobias Bocanegra <to...@day.com>
> wrote:
> >
> > > hi,
> > > you just give the input field of the form the same name as the
> > > property you want to save.
> > > regards, toby
> > >
> > > On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > I'm now able to create new nodes and subnodes in the Sling hierarchy
> > > with
> > > > bunkai. I'm now trying to load and save the 'contents' of each node,
> but
> > > I
> > > > can't seem to figure out what to call the form property.
> > > > Could someone help me out on this? I've tried to read Bertrands 15
> > >  minute
> > > > intro, but I'm not sure what the content property for a form could
> be.
> > > >
> > > > Thanks for any help
> > > >
> > > > Cheers,
> > > > PS
> > > >
> > >
> > >
> > > --
> > > -----------------------------------------< tobias.bocanegra@day.com>---
> > > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001
> Basel
> > > T +41 61 226 98 98, F +41 61 226 98 97
> > > -----------------------------------------------< http://www.day.com>---
> > >
> >
>
>
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
>

Re: Bunkai coming closer

Posted by Tobias Bocanegra <to...@day.com>.
ok, there are several posibilities:
1) you create a node with some property, eg: 'content'. but then you
need a html.esp script to dump the 'content' out again.
2) you create a 'nt:file' node and store the content in the jcr:data
property. but this is not possible currently, since you can't define
the nodetype, yet).
3) you upload a file in a multipart post. the post servlet will
automatically create a nt:file or nt:resource node and store the
content in the jcr:data property. after that you should be able to
address the content directly.

hope this helps,
regards, toby


On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> Hmm. OK. That makes sense. but at the moment I'm trying to use the nodes as
> if they were files. Is there a magic property for 'content'?
> Or, wait, maybe I can use any property name at all, as long as I use the
> same all the time?
>
> But if I try to save contents of files (html files) using a property
> 'content'. How will they look when accessed as .html? I really don't think
> I've understood things :| :)
>
> Cheers,
> PS
>
> On Feb 11, 2008 10:04 PM, Tobias Bocanegra <to...@day.com> wrote:
>
> > hi,
> > you just give the input field of the form the same name as the
> > property you want to save.
> > regards, toby
> >
> > On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> > > Hi,
> > >
> > > I'm now able to create new nodes and subnodes in the Sling hierarchy
> > with
> > > bunkai. I'm now trying to load and save the 'contents' of each node, but
> > I
> > > can't seem to figure out what to call the form property.
> > > Could someone help me out on this? I've tried to read Bertrands 15
> >  minute
> > > intro, but I'm not sure what the content property for a form could be.
> > >
> > > Thanks for any help
> > >
> > > Cheers,
> > > PS
> > >
> >
> >
> > --
> > -----------------------------------------< tobias.bocanegra@day.com >---
> > Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> > T +41 61 226 98 98, F +41 61 226 98 97
> > -----------------------------------------------< http://www.day.com >---
> >
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Bunkai coming closer

Posted by Peter Svensson <ps...@gmail.com>.
Hmm. OK. That makes sense. but at the moment I'm trying to use the nodes as
if they were files. Is there a magic property for 'content'?
Or, wait, maybe I can use any property name at all, as long as I use the
same all the time?

But if I try to save contents of files (html files) using a property
'content'. How will they look when accessed as .html? I really don't think
I've understood things :| :)

Cheers,
PS

On Feb 11, 2008 10:04 PM, Tobias Bocanegra <to...@day.com> wrote:

> hi,
> you just give the input field of the form the same name as the
> property you want to save.
> regards, toby
>
> On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> > Hi,
> >
> > I'm now able to create new nodes and subnodes in the Sling hierarchy
> with
> > bunkai. I'm now trying to load and save the 'contents' of each node, but
> I
> > can't seem to figure out what to call the form property.
> > Could someone help me out on this? I've tried to read Bertrands 15
>  minute
> > intro, but I'm not sure what the content property for a form could be.
> >
> > Thanks for any help
> >
> > Cheers,
> > PS
> >
>
>
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
>

Re: Bunkai coming closer

Posted by Tobias Bocanegra <to...@day.com>.
hi,
you just give the input field of the form the same name as the
property you want to save.
regards, toby

On 2/11/08, Peter Svensson <ps...@gmail.com> wrote:
> Hi,
>
> I'm now able to create new nodes and subnodes in the Sling hierarchy with
> bunkai. I'm now trying to load and save the 'contents' of each node, but I
> can't seem to figure out what to call the form property.
> Could someone help me out on this? I've tried to read Bertrands 15  minute
> intro, but I'm not sure what the content property for a form could be.
>
> Thanks for any help
>
> Cheers,
> PS
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---