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?

[977 byte] By [hbquikcomjamesla] at [2007-11-27 6:52:46]
# 1
Well, I don't know what a VPN is, but the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html]How to Use Icons[/url] shows different ways to load an icon. I'm sure one of them will work for you.
camickra at 2007-7-12 18:27:22 > top of Java-index,Desktop,Core GUI APIs...
# 2
Virtual Private Network.
hbquikcomjamesla at 2007-7-12 18:27:22 > top of Java-index,Desktop,Core GUI APIs...
# 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.

hbquikcomjamesla at 2007-7-12 18:27:22 > top of Java-index,Desktop,Core GUI APIs...
# 4
Oh, and I'd be happy to put some Dukes on this, except that when I click on the URL to do it, all I get is an error page.
hbquikcomjamesla at 2007-7-12 18:27:22 > top of Java-index,Desktop,Core GUI APIs...
# 5
You lost me at Windoze.
kirillga at 2007-7-12 18:27:22 > top of Java-index,Desktop,Core GUI APIs...
# 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

hbquikcomjamesla at 2007-7-12 18:27:22 > top of Java-index,Desktop,Core GUI APIs...