views:

587

answers:

6

My client gave me the following requirement. I am not able to understand what he means He says:

I'm looking for a Java application that sets a mime-type for the user's computer system.

The application would be a very simple app (probably a single .class file?), which when run, sets this mime-type for the user's computer system:

application/adlm

Thus, if I am using Firefox or IE, for example, I can just check for the presence of the "application/adlm" mime-type. If present, your application worked.

Please provide some javascript or PHP that can be used to detect the present of a custom mime-type like this.

Please use the latest version of Java. I will test your application from the Windows command line. Please do not make it Windows-specific, though... it would be ideal if I could use your application on a Macintosh system, too.

Please note that I'm looking for a desktop java application, NOT a .jsp file (i.e., this needs to run from the Windows desktop, not on a web server)

+2  A: 

Computers don't have mime-types; HTTP responses do. Maybe he wants a web server that sends a reply using that MIME-type? It's just a matter of sending the right headers.

redtuna
Technically any MIME message has a MIME type. Mime originated as a mechanism for encapsulating rich content inside an RFC822 email message.
Jherico
+4  A: 

This makes no sense at all, given what a MIME-type is. A MIME-type is used to identify the format of a file distributed on a network, such as over the Internet.

Thomas Owens
However, Windows has a mechanism to associate the MIME type of content received in IE with a program to view/execute that content. See my answer.
Eric J.
True, but that has nothing to do with the question asked.
Thomas Owens
I'd question the legitimacy of this project's intended project. It looks like somebody would want to install a mime type handler on somebody's computer and then have arbitrary commands being ran when the user visits some web pages.
Sorin Mocanu
+1  A: 

I think they want you to be able to set the default application to open a file of the given mime-type.

I don't believe that this can be done in a cross-platform way -- you'll have to check the OS and do the appropriate thing.

Lou Franco
A: 

A mime type is a little thing that's stored with a file which tells the "computer system" what kind of file it is. This allows files not to have little silly extensions on the name. It's part of the UNIX specification.

kennyisaheadbanger
Since when are MIME types stored with files in Unix? I think you're a bit confused.
Jim Lewis
Something is... or am I thinking about on my mac
kennyisaheadbanger
Perhaps you're thinking of the "resource fork"? That's Mac specific, and rather a different concept from MIME types.
Jim Lewis
oh well... whoops
kennyisaheadbanger
+3  A: 

Sounds to me like your client wants to be able to add or edit a filetype in the registry. This means that when a file has a MIME-type of application/adlm, it is opened with whatever application is associated with application/adlm. This has more to do with system settings, I think.

You should verify with the client to make sure you know what they mean.

Charlie Salts
+2  A: 

On Windows and with Internet Explorer, a program can be associated with a particular mime type. So, if IE downloads content with that mime type, the registered program will be launched (subject to security layers).

For more information on how to implement this consult this MDSN article

Eric J.