Author: February 2010 Archives

I’ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients. For example, I’m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players.

Anyway, I fumbled around for a bit in Google and found one great solution: mime-util. It’s Apache License and works great. The documentation is even very good.

Since I can trust my file names I opted for the simple file name extension detection method. It’s a perfect fit except for one thing: I need to detect the application/json content type which is not part of the default property bundle.

It took me a few minutes of digging trough the JavaDocs to find the answer, so to save you some time, here’s my solution:

  1. Create a file named mime-types.properties and put it somewhere in your class path.
  2. Add the types you need as extension=type pairs like json=application/json
0 Votes

I’ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients. For example, I’m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players.

Anyway, I fumbled around for a bit in Google and found one great solution: mime-util. It’s Apache License and works great. The documentation is even very good.

Since I can trust my file names I opted for the simple file name extension detection method. It’s a perfect fit except for one thing: I need to detect the application/json content type which is not part of the default property bundle.

It took me a few minutes of digging trough the JavaDocs to find the answer, so to save you some time, here’s my solution:

  1. Create a file named mime-types.properties and put it somewhere in your class path.
  2. Add the types you need as extension=type pairs like json=application/json
0 Votes

Once upon a time I tried to open a file for editing with MacVim and saw this message:

$  vi foo.xml 
E575: viminfo: Illegal starting char in line: ion.properties
$

I assumed there was something wrong with the file that I was editing, so I tried a different file. I observed the same result.

**The Problem Your .viminfo file is corrupt. This file does not contain settings or anything, mostly temporary and working data.

**The Fix Delete your ~/.viminfo file

0 Votes

About this Archive

This page is an archive of recent entries written by Author in February 2010.

Author: January 2010 is the previous archive.

Author: March 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.