|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Mime-type from filename? |
« View previous topic :: View next topic » |
Author |
Message
|
marko.pitkanen |
Posted: Thu Nov 29, 2012 7:52 am Post subject: Mime-type from filename? |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
Broker version 7.0.0.4.
I need to implement interface where message flow posts data to external web application packing it into multipart/form-data. One part contains mime classified content and I need to define Content-Type from original filename.
What are good ways to find out Content-Type from filename?
I have searched only a bit from InfoCenter if broker can do it for me with built-in functionalities but found no positive answer.
I have tested that I can build Java wrapper around javax.activation.MimetypesFileTypeMap which then can be directed with mime.types -file.
I think I can implement also a database look-up for this conversion.
I'm asking your opinions and thoughts which way I should implement this to achieve solution that is align to product, maintainable and performs well.
--
Marko |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Nov 29, 2012 7:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
For this kind of thing, my preference is always to lean towards the thing that I don't have to actually maintain the contents of the lookup table.
So I'd either look for something like a well-published external website I can query, or I'd use the javax.activation file type map.
Unless you know that you have a very limited set of potential file types and a very limited set of file extensions? That is, if you know you're only ever attaching text files or JPG files, so you only need to decide between two things? Then I'd hard code it. If it's a relatively small set (like 10), then I might put them into UserDefinedProperties... but again there's a question of how much maintenance effort is that going to take. (How often will you need to add new types...)
Using a database for this is going to be more effort to maintain and likely take more time to query. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Mon Dec 03, 2012 3:04 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Thanks mqjeff,
Because this interface is for ECM, potential file-type space is wide and I decided to use javax.activation file type map through home made Java wrapper via external procedure from ESQL.
--
Marko |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|