Hi Dan, Le jeudi 10 f�vrier 2005 � 09:02 -0800, [EMAIL PROTECTED] a �crit : > On Thu, 10 Feb 2005 12:00:25 +0100, "Erik Bruchez" <[EMAIL PROTECTED]> > said: > > Eric van der Vlist wrote: > > > > > 1. That would be nice if the URL generator could rely on the media > > > type given by the OS for local files. For instance, if I read > > > a .swx file and that my OS is configured correctly, the URL > > > generator could guess that the media type is > > > "application/vnd.sun.xml.writer". > > > > Is there a standard mechanism in Java to get the media type of a file > > from the OS? With URLConnection, you can get information based on the > > content-type header if there is one, or based on content (fairly poorly > > implemented in the JDK last time I checked). > > Not in JDK 1.4. Haven't looked in JDK 1.5. > > In any case implementing it is a total mess. For example on > Linux I can specify the type associated with a file extension > via > o /etc/magic > o KDE's desktop settings > o GNOME desktop settings > o XPDE desktop settings > o .... > > So what gets used will depend how I log in.
Yes, media types are an incredibly simple idea which implementation is incredibly broken :-( ... > > And wrt /etc/magic, it isn't standard. That is that while it's > described in POSIX.2 it, in practice the format of the file, > the command lines to work with it, and the output from the tools > that do work with it, all vary from *NIX platform to platform. > > So getting the type from the OS when writing Java isn't a > good proposition. > > On the other hand, perhaps there something that can be done > in JavaScript. That is if what one wants to do is meet > the browser user's expectation wrt to file type then perhaps > JavaScript could be used to achieve this.... Yes, but that's not the case here: I'd just like that the URL generator be able to guess the type from the filename, all that server side! I think that having a presentation server global media-type.xml property file and a class to exploit it would help a lot and would provide consistency over the different processors. Eric > -- Regards, Dan S > > > ------------------------------------------------------- > 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_id=6595&alloc_id=14396&op=click > _______________________________________________ > orbeon-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/orbeon-user > > -- Did you know it? Python has now a Relax NG (partial) implementation. http://advogato.org/proj/xvif/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ ------------------------------------------------------- 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 _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
