/*
 * This file is part of Mapyrus, software for plotting maps.
 * Copyright (C) 2003, 2004, 2005 Simon Chenery.
 *
 * Mapyrus is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Mapyrus is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Mapyrus; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

/*
 * @(#) $Id$
 */
package org.mapyrus;

import java.net.URLConnection;

/**
 * MIME types for filename extensions.
 * Provides a lookup of MIME types for filename extensions.
 */
public class MimeTypes
{
	/**
	 * Returns the MIME type for a given file extension.
	 * @param extension is filename suffix to lookup MIME type for.
	 * @return MIME type for extension, or null if it is not known.
	 */
	public static String get(String extension)
	{
		/*
		 * Convert SVG MIME type ourselves as it does not
		 * yet appear in my MIME type database.
		 */
		String retval;
		if (extension.equalsIgnoreCase("svg") ||
			extension.equalsIgnoreCase("svgz"))
		{
			retval = "image/svg+xml";
		}
		else
		{
			retval = URLConnection.guessContentTypeFromName("x." + extension);
		}
		return(retval);
	}
}

@@ -1282,13 +1282,118 @@
 %0A%09%7B%0A
+%09%09String retval;%0A%09%09if (extension.equalsIgnoreCase(%22svg%22) %7C%7C%0A%09%09%09extension.equalsIgnoreCase(%22svgz%22))%0A%09%09%7B%0A%09
 %09%09/*%0A
+%09
 %09%09 *
@@ -1440,16 +1440,17 @@
 oes not%0A
+%09
 %09%09 * yet
@@ -1489,114 +1489,160 @@
 .%0A%09%09
+%09
  */%0A%09%09
-String retval;%0A%09%09if (extension.equalsIgnoreCase(%22svg%22) %7C%7C%0A%09%09%09extension.equalsIgnoreCase(%22svgz%22))%0A%09%09%7B
+%09retval = %22image/svg+xml%22;%0A%09%09%7D%0A%09%09else if (extension.equalsIgnoreCase(%22tfw%22))%0A%09%09%7B%0A%09%09%09/*%0A%09%09%09 * Geoferencing files for images are text files.%0A%09%09%09 */
 %0A%09%09%09
@@ -1647,37 +1647,34 @@
 %09%09retval = %22
-image/svg+xml
+text/plain
 %22;%0A%09%09%7D%0A%09%09els

Set MIME type text/plain for .tfw files.