Browser can resolve, access, and display JPEG image, but ImageIcon can't.
I've got this weird problem that only happens with images accessed through a customer's VPN:
Microsloth Internet Imploder can resolve, access, and display a JPG image from a VPN URL, in the general form:
http://intranet/part?FOOBAR.JPG
which the browser apparently transmogrifies into
http://mogrify.foo.com/images/scripts/cgi/detail.cgi?FOOBAR.JPG
(as Jack Webb often said, the names have been changed to protect the innocent)
Firefox can also resove, access, and display the image.
But an ImageIcon, when fed either URL, quietly fails to get anything, No errors, no exceptions, but no image, either.
The application, if it detects the failure of ImageIcon to come up with the image, somehow (not my code) defers to "Windoze Image and Fax Viewer," which locks up trying to resolve, access, and display the image.
What could possibly be going on here?
# 3
Actually, the only reason we use ImageIcons here is simplicity of loading and simplicity of display.
Elsewhere in the application, we use an ImageIcon to load the image, but then display it by other means (using a Graphics.drawImage()).
The point is that the image is NOT in the file system, and it's NOT in the jar. Browsers can get it, but somehow an ImageIcon can't.
# 6
I'd love to have the luxury of saying, "You lost me at Windoze." Then again, to paraphrase a running gag from Airplane!, it looks like I picked the wrong week to quit hemlock.
As my final message on my other thread on this topic indicates, the problem is that even though the URL ends in JPG, the server isn't really serving up a JPEG, but rather, an HTML page containing the JPEG.
Knowing this, a solution (of sorts) presented itself: if the URL doesn't produce a displayable ImageIcon, try constructing a JEditorPane on the URL. The results aren't exactly pretty, and you do have to try the ImageIcon first, but it does work.
--
JHHL