On Wed, Oct 31, 2018 at 10:30 PM Igal Sapir <isa...@apache.org> wrote:

> >> Unless DefaultServlet behaviour is fixed, enabling probeContentType is
> >> likely to break my configurations.
>
> How about allowing to remove a Mime type by mapping it to an empty
> string?  That way you would only need to override that one in your
> Application's web.xml.
>
> Would that work?
>

That won't work, but I'm adding an init-param for the feature to disable it
at the same time.


>
> >> 4. I see a similarity to mod_mime_magic module of HTTPD.
> >>
> >> http://httpd.apache.org/docs/current/mod/mod_mime.html
> >> http://httpd.apache.org/docs/current/mod/mod_mime_magic.html
> >>
> >> (For some reason I though that mod_mime_magic uses the magic file from
> >> Unix OS.
> >> Actually it uses its own magic file from configuration of HTTPD,
> >> configured by directive "MimeMagicFile".
> >> So it is actually portable.)
> >>
> >> MimeMagicFile directive is disabled by default.
> >>
> >>
> http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/httpd.conf.in?view=markup#l330
> >>
> >> Performance =?
> >> The documentation of mod_mime_magic says that performance is a concern
> >> for this module.
>
> The lookup will only happen for unknown types, and as Remy said they
> will be cached so I don't think that performance is an issue here.
>
> >
> > No idea really, probeContentType checks a number of sources [on Fedora it
> > is: new GnomeFileTypeDetector(), new
> > MimeTypesFileTypeDetector(userMimeTypes), new
> > MimeTypesFileTypeDetector(etcMimeTypes), new MagicFileTypeDetector()],
> and
> > it is platform dependent as you say. The result is then cached into the
> > resource in Tomcat, so it should be "ok" performance wise. The question
> is:
> > besides the default servlet not respecting a possibly set content-type (I
> > have not looked at it, and IMO it is a separate issue, no problem if
> you'd
> > like to fix it), is the Files.probeContentType result good enough on
> > Windows ?
>
> I have both Windows and Fedora so if you want me to test something
> specific please let me know.
>

Looked at the code, Windows uses the registry only (so something that may
be incomplete and not standardized). As a result, it would be unreasonable
to remove the current default mappings.
Example: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8080369

Rémy

Reply via email to