Bel Od - 2004-06-30

It all works now!

To summarize :

-- I created a class HTTPClient that extends acdk::net::HttpURLConnection. I is based
on your class HttpURLConnectionImpl

-- I make a GET call to a servlet that sends me back a file that is base64 encoded

-- I use HTTP/1.0 instead of HTTP/1.1 to avoid problems with
Transfer-Encoding: chunked

-- I add a method to the class to retrieve the content of the response:

void HTTPClient::getResponseToFile(RString fileName) {
    RFile f1 = new File(fileName);
    RFileWriter fw1 = new FileWriter(f1);
    RString line;
    for (;;) {
        line = in_stream->readLine();
    RbyteArray bytes = line->getBytes();
    int lineLen = bytes.length();
    fw1->write(bytes, 0, lineLen);
        if (line->trim()->equals(""))
              break;
    }
    fw1->close();
    f1 = Nil;
}

-- I call the class in my runner class as follows:

  RURL url = new URL(new String("http://blablabla"));
  RHTTPClient hc = new HTTPURLClient(url);
  hc->setRequestMethod("GET");
  hc->connect();
  hc->getResponseToFile("D:\\temp\\file_received.txt");