tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Cook" <jimc...@iname.com>
Subject Suggestion: Change to org.apache.tomcat.util.StringManager
Date Wed, 28 Jun 2000 03:00:56 GMT
I found it useful to add the following static method to StringManager:

public synchronized static StringManager getManager(String packageName,
ClassLoader loader) {
    StringManager mgr = (StringManager)managers.get(packageName);
    if (mgr == null) {
        mgr = new StringManager(packageName, loader);
        managers.put(packageName, mgr);
    }
    return mgr;
}

This method exposes the ClassLoader to the getManager() method. It allows a
StringManager class to be instantiated within a servlet. I can now use the
following line in my servlet to create a StringManager:

private StringManager sm = StringManager.getManager(Constants.PACKAGE_NAME,
MyServlet.class.getClassLoader());

hope it helps,
jim


Mime
View raw message