You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave <ja...@yahoo.com> on 2008/10/07 23:03:26 UTC

video/x-flv mime-mapping does not for Tomcat 5.5

we are using JBoss4.0.5.  For flash video, we added 
 
<mime-mapping>
      <extension>flv</extension>
      <mime-type>video/x-flv</mime-type>
 </mime-mapping>
 
in tomcat conf/web.xml.
 
Restarted jboss. When uploading a foo.flv,  uploadeFile.getContentType returns "application/octet-stream", not "video/x-flv".  Could you please help me?
 
Thanks,
Dave


      

Re: video/x-flv mime-mapping does not for Tomcat 5.5

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



André Warnier wrote:
> Johnny Kewl wrote:
>>
>> ----- Original Message ----- From: "Dave" <ja...@yahoo.com>
>> To: "Tomcat Users List" <us...@tomcat.apache.org>
>> Sent: Tuesday, October 07, 2008 11:03 PM
>> Subject: video/x-flv mime-mapping does not for Tomcat 5.5
>>
>>
>> we are using JBoss4.0.5. For flash video, we added
>>
>> <mime-mapping>
>> <extension>flv</extension>
>> <mime-type>video/x-flv</mime-type>
>> </mime-mapping>
>>
>> in tomcat conf/web.xml.
>>
>> Restarted jboss. When uploading a foo.flv, uploadeFile.getContentType
>> returns "application/octet-stream", not "video/x-flv". Could you
>> please help me?
>>
> I think Johnny's talking nonsense.  But he's gone watch the debate, so I
> can probably get away with this.
> 
> Seriously, my guess :
> I think you are confusing what happens on the way in (browser -> Tomcat)
> with what happens on the way out (Tomcat -> browser).
> The <mime-mappings> above probably only tell Tomcat what it should put
> in the HTTP response headers as "Content-type" when *returning* such a
> file to the browser.
> 
> On the way in, on the other hand, it is the browser that "guesses" the
> file type, and sends this to the server as part of the POST data.  The
> server then just picks up what the browser says.
> If the browser doesn't know what the file is, it will probably in this
> case determine that the file is "binary" (not text), and since it does
> not know a precise type, it will send it with a type
> "application/octet-stream", which is the standard safe Mime type for any
> binary file you do not really know the type of.
> 
> Try the following : somewhere in your browser or your operating system,
> there must be a way to specify that "..for this file type .. do this".
> Do that for this file type, and then try to resubmit the same file to
> your Tomcat application and see what it says.
> 
> If it then works, unfortunately that is only a solution for your own
> browser and your own workstation.
> In order to determine the file type correctly no matter which browser it
> comes from, you probably have to do it in your application.
> 
> There exist standard modules/add-ons/libraries/subroutines in most
> programming languages, that can make guesses at the mime type of a file.
>  Unfortunately in Java I personally don't know what it would be.
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvaFIACgkQ9CaO5/Lv0PAU6ACgv9T2Cs9QXQMMw3cwaZ1nanY5
QsUAn1T/KVvoljpv30b9pWCdXhkHk4n3
=GiGc
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: video/x-flv mime-mapping does not for Tomcat 5.5

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

(Sorry for the blank post. Who knew CTRL-ENTER would ever be something I
would hit accidentally?)

André Warnier wrote:
> There exist standard modules/add-ons/libraries/subroutines in most
> programming languages, that can make guesses at the mime type of a file.
> Unfortunately in Java I personally don't know what it would be.

You've hit the nail on the head: the browser doesn't "know" the
content-type of the file, so it just uses the generic
"application/octet-stream".

On the server side, you need to figure out what that should be converted
to if you don't like the content-type provided by the client (browser).
You can do this in any servlet like this:

String guessedContentType = getServletContext().getMimeType(filename);

This method should use the mime-type mapping you have set up in
conf/web.xml.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvaRoACgkQ9CaO5/Lv0PBoZgCeIDqXjKl6rQHdvQZG3nTliCrU
sKYAn3ku1W3aWbvjiv/E1PO+pDy1tV22
=Gshk
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: video/x-flv mime-mapping does not for Tomcat 5.5

Posted by André Warnier <aw...@ice-sa.com>.
Johnny Kewl wrote:
> 
> ----- Original Message ----- From: "Dave" <ja...@yahoo.com>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, October 07, 2008 11:03 PM
> Subject: video/x-flv mime-mapping does not for Tomcat 5.5
> 
> 
> we are using JBoss4.0.5. For flash video, we added
> 
> <mime-mapping>
> <extension>flv</extension>
> <mime-type>video/x-flv</mime-type>
> </mime-mapping>
> 
> in tomcat conf/web.xml.
> 
> Restarted jboss. When uploading a foo.flv, uploadeFile.getContentType 
> returns "application/octet-stream", not "video/x-flv". Could you please 
> help me?
> 
I think Johnny's talking nonsense.  But he's gone watch the debate, so I 
can probably get away with this.

Seriously, my guess :
I think you are confusing what happens on the way in (browser -> Tomcat) 
with what happens on the way out (Tomcat -> browser).
The <mime-mappings> above probably only tell Tomcat what it should put 
in the HTTP response headers as "Content-type" when *returning* such a 
file to the browser.

On the way in, on the other hand, it is the browser that "guesses" the 
file type, and sends this to the server as part of the POST data.  The 
server then just picks up what the browser says.
If the browser doesn't know what the file is, it will probably in this 
case determine that the file is "binary" (not text), and since it does 
not know a precise type, it will send it with a type 
"application/octet-stream", which is the standard safe Mime type for any 
binary file you do not really know the type of.

Try the following : somewhere in your browser or your operating system, 
there must be a way to specify that "..for this file type .. do this".
Do that for this file type, and then try to resubmit the same file to 
your Tomcat application and see what it says.

If it then works, unfortunately that is only a solution for your own 
browser and your own workstation.
In order to determine the file type correctly no matter which browser it 
comes from, you probably have to do it in your application.

There exist standard modules/add-ons/libraries/subroutines in most 
programming languages, that can make guesses at the mime type of a file. 
  Unfortunately in Java I personally don't know what it would be.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: video/x-flv mime-mapping does not for Tomcat 5.5

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Dave" <ja...@yahoo.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, October 07, 2008 11:03 PM
Subject: video/x-flv mime-mapping does not for Tomcat 5.5


we are using JBoss4.0.5. For flash video, we added

<mime-mapping>
<extension>flv</extension>
<mime-type>video/x-flv</mime-type>
</mime-mapping>

in tomcat conf/web.xml.

Restarted jboss. When uploading a foo.flv, uploadeFile.getContentType 
returns "application/octet-stream", not "video/x-flv". Could you please help 
me?

----------------------

Hi Dave...

Dave not many clients  (I think can do FLV)... so your browser probabaly 
doesnt know what it is, so the server cant sent it... my guess...
I think flash files are actually WMV files and inside those files is the FLV 
format...
I know on windows we had to jump thru hoops to make FLV's work... just on 
their own...

I think you have to convert them to WMV's

Have fun...

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------
If you cant pay in gold... get lost...








---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org