Hi Sebastian,

I managed to obtain the Location header in javascript. It seems server
should expose the header in the Access-Control-Expose-Headers so that
clients can access. However, I managed this with only Google Chrome.
Firefox 12 still returns the empty results. I read in some articles that
some browsers have buggy implementations regarding the
XMLHttpRequest.getRequestHeader method, e.g [1].

Anyway, I will add the necessary code exposing the headers.

Best,
Suat

[1] http://www.html5rocks.com/en/tutorials/cors/

On 05/16/2012 04:39 PM, Sebastian Germesin wrote:
> Hi Suat,
>
> thanks for checking and for the link. That is bad... How do you think can we 
> ship around this?
>
> From my point of view, duplicating the location (the URI) in the content of 
> the response does not
> hurt the specs and helps me on the client side.
>
> Would that be a proper solution?
>
> Best regards,
>
> Sebastian
>
> On 16.05.2012, at 15:26, Suat Gonul wrote:
>
>> Hi Sebastian,
>>
>> I have tried a number of cases for the header specifications while
>> sending the query to Contenthub, but I could not read the Location
>> header with jQuery at all, even any other headers. However, the details
>> of the response seems like as follows through the Live HTTP Headers
>> plugin in Firefox:
>>
>> HTTP/1.1 201 Created
>> Access-Control-Allow-Origin: *
>> Location:
>> http://localhost:8080/contenthub/contenthub/store/content/urn:content-item-sha1-358dbe75624b135aa72c1ad6cc34f325bf7fdf50
>>
>> Content-Length: 0
>> Server: Jetty(6.1.x)
>>
>> Then, I ran across the following note in [1]:
>> "The Cross-Origin Resource Sharing specification filters the headers
>> that are exposed by |getAllResponseHeaders()
>> <http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-getallresponseheaders>|
>> for non same-origin
>> <http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html#same-origin>
>> requests."
>>
>> I think this may be the reason. I'm not sure though.
>>
>> [1]
>> http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-getallresponseheaders
>>
>> Best,
>> Suat
>>
>>
>> On 05/15/2012 07:19 PM, Sebastian Germesin wrote:
>>> Dear all,
>>>
>>> we are currently working on extending the VIE.StanbolService and currently 
>>> face a problem with the content hub of Apache Stanbol.
>>>
>>> From the REST API, it seems that a simple HTTP-POST request is enough to 
>>> create a resource and in fact it works and the result is a HTTP response 
>>> (201 - Created).
>>>
>>> However, using jQuery, we are currently not able to retrieve the location 
>>> of the created resource, to be more precise, the "Location" header field is 
>>> not readable from jQuery.
>>>
>>> I've created a jsbin example for you to test the code:
>>>
>>> http://jsbin.com/unekoh/edit#javascript,html,live
>>>
>>> Could you please be so kind to have a look at it and check why jQuery is 
>>> not able to parse the header?
>>>
>>> Is it maybe possible to also send the location as response text?
>>>
>>>
>>> Thanks a lot in advance,
>>>
>>> Sebastian
> --
> M.Sc. Sebastian Germesin
>
> DFKI GmbH
> Campus D3 2
> Stuhlsatzenhausweg 3                 
> D-66123 Saarbruecken, Germany   
>
> phone:        +49 (681) 85775 - 5079 
> fax:          +49 (681) 85775 - 5021
> mail:         [email protected]
> http:         www.dfki.de/~germesin
> skype:        neogermi1337
> twitter:    germesin
>

Reply via email to