You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Tim Harsch <ha...@yahoo.com> on 2011/05/17 12:47:25 UTC

Fuseki gives HTTP ERROR: 415

Hi all,
I was wiring some code that trys to make a call to a a SPARQL endpoint service 
through a javascript XHR.  It fails with:

HTTP ERROR: 415
Problem accessing /dataset/sparql. Reason: 
    Unsupported: application/x-www-form-urlencoded; charset=UTF-8

So I installed firebug and noticed that when the URL is being fetched with an 
XHR call it has the following request header.
Content-Type: application/x-www-form-urlencoded; charset=UTF-8

This header is not present when just going to the same URL via the browser, and 
when it is not present it works as you might expect.  So, I then installed the 
Firefox Modify Headers plugin so I could alter the request header I was sending 
through the browser, and sure enough adding that one header causes the HTTP 
error you see above.  


So, since this is not my code but code I'm working with, altering the XHR call 
is a little difficult.  My question is: should Fuseki bail out when the 
Content-Type header is set as so?  I should also note that these XHR calls work 
when the endpoint is an older version of Joseki (Joseki, not Fuseki).

Thanks,
Tim


Re: Fuseki gives HTTP ERROR: 415

Posted by Tim Harsch <ha...@yahoo.com>.
Hi Andy, 
Thanks for the info.

FYI: It seems to be a problem in Firefox 4.0 only, Chrome and IE9 do not seem to 
append the charset part.  I read the HTML reference you provided but don't see 
where it says forms must be in US-ASCII.  It does say 
"application/x-www-form-urlencoded" and talks of '%HH' encoding the URL.



----- Original Message ----
> From: Andy Seaborne <an...@epimorphics.com>
> To: jena-users@incubator.apache.org
> Sent: Tue, May 17, 2011 4:42:44 AM
> Subject: Re: Fuseki gives HTTP ERROR: 415
> 
> 
> 
> On 17/05/11 11:47, Tim Harsch wrote:
> > Hi all,
> > I was  wiring some code that trys to make a call to a a SPARQL endpoint 
>service
> >  through a javascript XHR.  It fails with:
> >
> > HTTP ERROR:  415
> > Problem accessing /dataset/sparql. Reason:
> >       Unsupported: application/x-www-form-urlencoded;  charset=UTF-8
> >
> > So I installed firebug and noticed that when the  URL is being fetched with 
>an
> > XHR call it has the following request  header.
> > Content-Type: application/x-www-form-urlencoded;  charset=UTF-8
> >
> > This header is not present when just going to the  same URL via the browser, 
>and
> > when it is not present it works as you  might expect.  So, I then installed 
>the
> > Firefox Modify Headers  plugin so I could alter the request header I was 
>sending
> > through the  browser, and sure enough adding that one header causes the HTTP
> > error  you see above.
> >
> >
> > So, since this is not my code but code  I'm working with, altering the XHR 
>call
> > is a little difficult.  My  question is: should Fuseki bail out when the
> > Content-Type header is set  as so?  I should also note that these XHR calls 
>work
> > when the  endpoint is an older version of Joseki (Joseki, not Fuseki).
> >
> >  Thanks,
> > Tim
> >
> 
> It's a bug - it does not expect the charset  part.  It will be fixed 
> after the code move.
> 
> It's arguable  whether charset=utf-8 is legal  -
> 
> http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4
> 
> An  HTML form is US-ASCII and %xx encoding.
> 
>     Andy
> 

Re: Fuseki gives HTTP ERROR: 415

Posted by Andy Seaborne <an...@epimorphics.com>.

On 17/05/11 11:47, Tim Harsch wrote:
> Hi all,
> I was wiring some code that trys to make a call to a a SPARQL endpoint service
> through a javascript XHR.  It fails with:
>
> HTTP ERROR: 415
> Problem accessing /dataset/sparql. Reason:
>      Unsupported: application/x-www-form-urlencoded; charset=UTF-8
>
> So I installed firebug and noticed that when the URL is being fetched with an
> XHR call it has the following request header.
> Content-Type: application/x-www-form-urlencoded; charset=UTF-8
>
> This header is not present when just going to the same URL via the browser, and
> when it is not present it works as you might expect.  So, I then installed the
> Firefox Modify Headers plugin so I could alter the request header I was sending
> through the browser, and sure enough adding that one header causes the HTTP
> error you see above.
>
>
> So, since this is not my code but code I'm working with, altering the XHR call
> is a little difficult.  My question is: should Fuseki bail out when the
> Content-Type header is set as so?  I should also note that these XHR calls work
> when the endpoint is an older version of Joseki (Joseki, not Fuseki).
>
> Thanks,
> Tim
>

It's a bug - it does not expect the charset part.  It will be fixed 
after the code move.

It's arguable whether charset=utf-8 is legal -

http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4

An HTML form is US-ASCII and %xx encoding.

	Andy