Java Code Examples for com.sun.activation.registries.MimeTypeFile

The following examples show how to use com.sun.activation.registries.MimeTypeFile. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 2
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 3
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 4
/**
    * Load from the named resource.
    */
   private MimeTypeFile loadResource(String name) {
InputStream clis = null;
try {
    clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
    if (clis != null) {
	MimeTypeFile mf = new MimeTypeFile(clis);
	if (LogSupport.isLoggable())
	    LogSupport.log("MimetypesFileTypeMap: successfully " +
		"loaded mime types file: " + name);
	return mf;
    } else {
	if (LogSupport.isLoggable())
	    LogSupport.log("MimetypesFileTypeMap: not loading " +
		"mime types file: " + name);
    }
} catch (IOException e) {
    if (LogSupport.isLoggable())
	LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
} catch (SecurityException sex) {
    if (LogSupport.isLoggable())
	LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
} finally {
    try {
	if (clis != null)
	    clis.close();
    } catch (IOException ex) { }	// ignore it
}
return null;
   }
 
Example 5
/**
    * Construct a MimetypesFileTypeMap with programmatic entries
    * added from the InputStream.
    *
    * @param is	the input stream to read from
    */
   public MimetypesFileTypeMap(InputStream is) {
this();
try {
    DB[PROG] = new MimeTypeFile(is);
} catch (IOException ex) {
    // XXX - really should throw it
}
   }
 
Example 6
/**
    * Prepend the MIME type values to the registry.
    *
    * @param mime_types A .mime.types formatted string of entries.
    */
   public synchronized void addMimeTypes(String mime_types) {
// check to see if we have created the registry
if (DB[PROG] == null)
    DB[PROG] = new MimeTypeFile(); // make one

DB[PROG].appendToRegistry(mime_types);
   }
 
Example 7
Source Project: jdk8u60   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 8
Source Project: jdk8u60   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 9
Source Project: jdk8u60   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 10
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 11
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 12
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 13
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 14
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 15
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 16
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 17
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 18
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 19
Source Project: hottub   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 20
Source Project: hottub   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 21
Source Project: hottub   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 22
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 23
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 24
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 25
/**
 * Load from the named resource.
 */
private MimeTypeFile loadResource(String name) {
    InputStream clis = null;
    try {
        clis = SecuritySupport.getResourceAsStream(this.getClass(), name);
        if (clis != null) {
            MimeTypeFile mf = new MimeTypeFile(clis);
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: successfully " +
                    "loaded mime types file: " + name);
            return mf;
        } else {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: not loading " +
                    "mime types file: " + name);
        }
    } catch (IOException e) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, e);
    } catch (SecurityException sex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex);
    } finally {
        try {
            if (clis != null)
                clis.close();
        } catch (IOException ex) { }        // ignore it
    }
    return null;
}
 
Example 26
/**
 * Construct a MimetypesFileTypeMap with programmatic entries
 * added from the InputStream.
 *
 * @param is        the input stream to read from
 */
public MimetypesFileTypeMap(InputStream is) {
    this();
    try {
        DB[PROG] = new MimeTypeFile(is);
    } catch (IOException ex) {
        // XXX - really should throw it
    }
}
 
Example 27
/**
 * Prepend the MIME type values to the registry.
 *
 * @param mime_types A .mime.types formatted string of entries.
 */
public synchronized void addMimeTypes(String mime_types) {
    // check to see if we have created the registry
    if (DB[PROG] == null)
        DB[PROG] = new MimeTypeFile(); // make one

    DB[PROG].appendToRegistry(mime_types);
}
 
Example 28
/**
 * Load all of the named resource.
 */
private void loadAllResources(Vector v, String name) {
    boolean anyLoaded = false;
    try {
        URL[] urls;
        ClassLoader cld = null;
        // First try the "application's" class loader.
        cld = SecuritySupport.getContextClassLoader();
        if (cld == null)
            cld = this.getClass().getClassLoader();
        if (cld != null)
            urls = SecuritySupport.getResources(cld, name);
        else
            urls = SecuritySupport.getSystemResources(name);
        if (urls != null) {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: getResources");
            for (int i = 0; i < urls.length; i++) {
                URL url = urls[i];
                InputStream clis = null;
                if (LogSupport.isLoggable())
                    LogSupport.log("MimetypesFileTypeMap: URL " + url);
                try {
                    clis = SecuritySupport.openStream(url);
                    if (clis != null) {
                        v.addElement(new MimeTypeFile(clis));
                        anyLoaded = true;
                        if (LogSupport.isLoggable())
                            LogSupport.log("MimetypesFileTypeMap: " +
                                "successfully loaded " +
                                "mime types from URL: " + url);
                    } else {
                        if (LogSupport.isLoggable())
                            LogSupport.log("MimetypesFileTypeMap: " +
                                "not loading " +
                                "mime types from URL: " + url);
                    }
                } catch (IOException ioex) {
                    if (LogSupport.isLoggable())
                        LogSupport.log("MimetypesFileTypeMap: can't load " +
                                            url, ioex);
                } catch (SecurityException sex) {
                    if (LogSupport.isLoggable())
                        LogSupport.log("MimetypesFileTypeMap: can't load " +
                                            url, sex);
                } finally {
                    try {
                        if (clis != null)
                            clis.close();
                    } catch (IOException cex) { }
                }
            }
        }
    } catch (Exception ex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, ex);
    }

    // if failed to load anything, fall back to old technique, just in case
    if (!anyLoaded) {
        LogSupport.log("MimetypesFileTypeMap: !anyLoaded");
        MimeTypeFile mf = loadResource("/" + name);
        if (mf != null)
            v.addElement(mf);
    }
}
 
Example 29
/**
    * Load all of the named resource.
    */
   private void loadAllResources(Vector v, String name) {
boolean anyLoaded = false;
try {
    URL[] urls;
    ClassLoader cld = null;
    // First try the "application's" class loader.
    cld = SecuritySupport.getContextClassLoader();
    if (cld == null)
	cld = this.getClass().getClassLoader();
    if (cld != null)
	urls = SecuritySupport.getResources(cld, name);
    else
	urls = SecuritySupport.getSystemResources(name);
    if (urls != null) {
	if (LogSupport.isLoggable())
	    LogSupport.log("MimetypesFileTypeMap: getResources");
	for (int i = 0; i < urls.length; i++) {
	    URL url = urls[i];
	    InputStream clis = null;
	    if (LogSupport.isLoggable())
		LogSupport.log("MimetypesFileTypeMap: URL " + url);
	    try {
		clis = SecuritySupport.openStream(url);
		if (clis != null) {
		    v.addElement(new MimeTypeFile(clis));
		    anyLoaded = true;
		    if (LogSupport.isLoggable())
			LogSupport.log("MimetypesFileTypeMap: " +
			    "successfully loaded " +
			    "mime types from URL: " + url);
		} else {
		    if (LogSupport.isLoggable())
			LogSupport.log("MimetypesFileTypeMap: " +
			    "not loading " +
			    "mime types from URL: " + url);
		}
	    } catch (IOException ioex) {
		if (LogSupport.isLoggable())
		    LogSupport.log("MimetypesFileTypeMap: can't load " +
					url, ioex);
	    } catch (SecurityException sex) {
		if (LogSupport.isLoggable())
		    LogSupport.log("MimetypesFileTypeMap: can't load " +
					url, sex);
	    } finally {
		try {
		    if (clis != null)
			clis.close();
		} catch (IOException cex) { }
	    }
	}
    }
} catch (Exception ex) {
    if (LogSupport.isLoggable())
	LogSupport.log("MimetypesFileTypeMap: can't load " + name, ex);
}

// if failed to load anything, fall back to old technique, just in case
if (!anyLoaded) {
    LogSupport.log("MimetypesFileTypeMap: !anyLoaded");
    MimeTypeFile mf = loadResource("/" + name);
    if (mf != null)
	v.addElement(mf);
}
   }
 
Example 30
Source Project: jdk8u60   Source File: MimetypesFileTypeMap.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * Load all of the named resource.
 */
private void loadAllResources(Vector v, String name) {
    boolean anyLoaded = false;
    try {
        URL[] urls;
        ClassLoader cld = null;
        // First try the "application's" class loader.
        cld = SecuritySupport.getContextClassLoader();
        if (cld == null)
            cld = this.getClass().getClassLoader();
        if (cld != null)
            urls = SecuritySupport.getResources(cld, name);
        else
            urls = SecuritySupport.getSystemResources(name);
        if (urls != null) {
            if (LogSupport.isLoggable())
                LogSupport.log("MimetypesFileTypeMap: getResources");
            for (int i = 0; i < urls.length; i++) {
                URL url = urls[i];
                InputStream clis = null;
                if (LogSupport.isLoggable())
                    LogSupport.log("MimetypesFileTypeMap: URL " + url);
                try {
                    clis = SecuritySupport.openStream(url);
                    if (clis != null) {
                        v.addElement(new MimeTypeFile(clis));
                        anyLoaded = true;
                        if (LogSupport.isLoggable())
                            LogSupport.log("MimetypesFileTypeMap: " +
                                "successfully loaded " +
                                "mime types from URL: " + url);
                    } else {
                        if (LogSupport.isLoggable())
                            LogSupport.log("MimetypesFileTypeMap: " +
                                "not loading " +
                                "mime types from URL: " + url);
                    }
                } catch (IOException ioex) {
                    if (LogSupport.isLoggable())
                        LogSupport.log("MimetypesFileTypeMap: can't load " +
                                            url, ioex);
                } catch (SecurityException sex) {
                    if (LogSupport.isLoggable())
                        LogSupport.log("MimetypesFileTypeMap: can't load " +
                                            url, sex);
                } finally {
                    try {
                        if (clis != null)
                            clis.close();
                    } catch (IOException cex) { }
                }
            }
        }
    } catch (Exception ex) {
        if (LogSupport.isLoggable())
            LogSupport.log("MimetypesFileTypeMap: can't load " + name, ex);
    }

    // if failed to load anything, fall back to old technique, just in case
    if (!anyLoaded) {
        LogSupport.log("MimetypesFileTypeMap: !anyLoaded");
        MimeTypeFile mf = loadResource("/" + name);
        if (mf != null)
            v.addElement(mf);
    }
}