myexperiment-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Myexperiment-discuss] Empty file returned


From: Linde, A.E.
Subject: Re: [Myexperiment-discuss] Empty file returned
Date: Wed, 22 Oct 2008 15:37:24 +0100

Solved it – thanks to James for ruby-debug pointer: uri.path does not contain the query part so I needed:
  http.get(uri.path + (uri.query ? "?"+uri.query : ""))

T.


On 22/10/2008 14:57, "Linde, A.E." <address@hidden> wrote:

I’m wondering if I’m doing something stupid here. I have a _javascript_ routine that does a GET on a foreign endpoint via a proxy class that Don gave me but I keep getting back an empty file whether the proxy is called by the _javascript_ or by sticking the http://localhost:3000/proxy/uri=... directly into the browser address (response below is ‘no response text’) where calling the endpoint by sticking that into a browser address returns the correct file. Can anyone see what I’m doing wrong?

Thanks,
Tony.

=======================
Rails (uri=’http://localhost:8080/sac/mysac?metadata’)
====
# Proxy controller require 'net/http' require 'uri' class ProxyController < ApplicationController   # GET /proxy  def proxy     query = CGIMethods.parse_query_parameters(request.query_string)    uri   = URI.parse(query['uri'])     response = Net::HTTP.start(uri.host, uri.port) { |http|      http.get(uri.path)    }     send_data(response.body, :type => response['content-type'],        :status => "#{response.code} #{response.message}")  end end =======================


--
Tony Linde
Project Manager
Department of Physics & Astronomy
University of Leicester

reply via email to

[Prev in Thread] Current Thread [Next in Thread]