I looked into the sources and yes a JarURLConnection looks first in the inputstream itself
It calls the public String guessContentTypeFromStream(InputStream is) of URLConnection
And only if that fails it goes to:

    public static String guessContentTypeFromName(String fname) {
    return getFileNameMap().getContentTypeFor(fname);
    }


FileURLConnection doesn't do guess by stream but direct does that through the filename map:

        FileNameMap map = java.net.URLConnection.getFileNameMap();
        contentType = map.getContentTypeFor(filename);

in the initializeHeaders method.

So if you really want the right content type you should first try the call the static guesContentTypeFromStream
of the URLConnection class.

Should i change this so that file also first checks by stream?

johan


Juergen Donnerstag wrote:
On 4/18/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
  
So the jar: is right and the file isn't?
    

yes

  
So the jar seems to look at the first bytes but the file just to the
extention?
    

yes

  
I will debug this to test what the difference is in the underlying
implementation.

    

I've renamed *.gif to *.jpeg and committed it this morning. I think it
is working now. But I'm be interested to know if there is really a
difference in the implementation.


Juergen


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

  

Reply via email to