Posted by turks
on May 21, 2009 at 8:14 AM PDT
I'm using the Java Toolkit to retrieve jpeg images from a url. The toolkit provides a nice simple method to do this (see below)
public static Image blockingLoad(URL url)
Image image = Toolkit.getDefaultToolkit().createImage(url);
if (waitForImage(image) == false)
The problem is that I would like to set some URL "Request Properties", in particular
("Accept-Encoding", "gzip, deflate") because I have found that retrieving these same
jpeg image through the browser, the browser inserts ("Accept-Encoding", "gzip, deflate")
into the request header and the jpeg transfered is 20-40% smaller that the jpeg itself.
(gzip is obviously enabled on the server)
Does anyone know if it is possible to pass any URL "Request Properties" while at the same time using the Java Image Toolkit or is it just too abstracted.