You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Vidar Ramdal <vi...@idium.no> on 2008/03/04 12:19:54 UTC

Trouble posting data from form

I've created a simple HTML form to post data to Sling. The form
should, in my mind, should work exactly like the curl command
specified in the 15-minute guide:

curl --trace - -F"sling:resourceType=foo/bar" -F"title=some title"
http://admin:admin@localhost:8888/content/mynode
The curl command works fine, and saves data to JCR as expected.

The <form> element looks like this:
<form method="post" action="http://admin:admin@localhost:8888/content/mynode">
  <input type="text" name="title" />
  <input type="text" value="foo/bar" size="30" name="sling:resourceType" />
  <button type="submit">Post</button>
</form>

Posting the form consistently returns a 500 error:
Error while processing /content/mynode
Status 	500
Message 	javax.jcr.AccessDeniedException: /: not allowed to modify item
Location 	/content/mynode
Parent Location 	/content
Path 	/content/mynode

I suspect curl handles the authentication part (admin:admin@)
differently than the browser does. How can I make the HTML form work?

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway

Re: Trouble posting data from form

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Mar 4, 2008 at 2:29 PM, Vidar Ramdal <vi...@idium.no> wrote:

> ... I was using the latest Firefox 3 beta. Reverting to Firefox 2, I get
>  the config options.
>  BTW, it didn't work in either Safari or Opera 9....

Thanks for reporting, this is now
https://issues.apache.org/jira/browse/SLING-308

-Bertrand

Re: Trouble posting data from form

Posted by Vidar Ramdal <vi...@idium.no>.
> On Tue, Mar 4, 2008 at 1:29 PM, Vidar Ramdal <vi...@idium.no> wrote:
>  >  > [...]   you go to http://localhost:8888/sling/configMgr [...]
>  >
>  >  Hmm, that page shows up blank - that is, only the header and the menu
>  >  appears - no config options.

On 3/4/08, Bertrand Delacretaz <bd...@apache.org> wrote:
> hmm...looks like that page doesn't work in Safari, but it works for me
>  on Firefox 2.0.0.12 - what browser are you using, and can you try
>  firefox?

I was using the latest Firefox 3 beta. Reverting to Firefox 2, I get
the config options.
BTW, it didn't work in either Safari or Opera 9.
Thanks for your help!

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway

Re: Trouble posting data from form

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Mar 4, 2008 at 1:29 PM, Vidar Ramdal <vi...@idium.no> wrote:
>  > [...]   you go to http://localhost:8888/sling/configMgr [...]
>
>  Hmm, that page shows up blank - that is, only the header and the menu
>  appears - no config options.

hmm...looks like that page doesn't work in Safari, but it works for me
on Firefox 2.0.0.12 - what browser are you using, and can you try
firefox?

-Bertrand

Re: Trouble posting data from form

Posted by Vidar Ramdal <vi...@idium.no>.
> On Tue, Mar 4, 2008 at 12:19 PM, Vidar Ramdal <vi...@idium.no> wrote:
> > [...] How can I make the HTML form work?...

On 3/4/08, Bertrand Delacretaz <bd...@apache.org> wrote:
> [...]   you go to http://localhost:8888/sling/configMgr [...]

Hmm, that page shows up blank - that is, only the header and the menu
appears - no config options.

-- 
Vidar S. Ramdal <vi...@idium.no> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway

Re: Trouble posting data from form

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Mar 4, 2008 at 12:19 PM, Vidar Ramdal <vi...@idium.no> wrote:

> ... <form method="post" action="http://admin:admin@localhost:8888/content/mynode">...

> ... I suspect curl handles the authentication part (admin:admin@)
>  differently than the browser does. How can I make the HTML form work?...

Your guess is right, this is due to the recent changes that have
allowed anonymous access by default.

I'm not sure how to fix that without config changes, but for now if
you go to http://localhost:8888/sling/configMgr, select the "Sling
Authenticator" config and save it with "Allow Anonymous Access" set to
false, your form should work.

-Bertrand