On Nov 24, 6:34 pm, Tony <[EMAIL PROTECTED]> wrote:
> I'm building an extension to an existing Rails app but have hit a
> problem the developers cannot seem to help me with. From a javascript-
> based shadowbox, I post an addition to a RDF triplestore via a proxy
> call: with the following in the Rails app ('uri' is the triplestore
> address, 'claim' the RDF to be added):
>
> response = Net::HTTP.start(uri.host, uri.port) { |http|
> http.request_post(uri.path, claim, { 'Content-type' => 'text/
> turtle' })
>
> }
>
> and want to return the triplestore response to the javascript call. I
> was told to use:
>
> send_data(response.body, :type => response['content-type'],
> :status => "#{response.code}")
>
> which half works. But I need to return the response['location'] value
> as it contains the uri of the added rdf. But send_data does not seem
> to allow the return of the location: is there any way that I can do
> this?
>
Where were you planning on storing it ? It's either the body or a
header of some sort.
For a javascript client you might set
response.headers['X-JSON'] = {:location => foo}.to_json
Prototype response handlers get passed this header (after it has been
parsed into a JS object)
Fred
> Thanks,
> Tony.
>
> (Apologies if this is a simple or stupid question: I'm trying to do
> this complex (to me) stuff with very little Rails knowledge)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---