Does it work with the StripesResources.properties?
I guess if I place the file out of classpath, Stripes' 
DefaultLocalizationBundleFactory wouldn't find it.
Or am I missing something?

// Iwao

Ing. Jan Novotný wrote on 08.4.10 10:40 PM:
> What about reading it directly from the filesystem instead of
> classpath? Then it needs "just" to check timestamp of that file and
> reread it in runtime. I do that with Spring all the time. For
> development phase this would suffice, does it not?
> 
> Jan
> 
> 2008/4/10, Iwao AVE! <[EMAIL PROTECTED]>:
>> You mean *without* reloading context? That sounds nice...
>>  But I think there's no legitimate way to achieve it with the containers
>>  that I use; i.e. Jetty and Tomcat.
>>
>>  // Iwao
>>
>>  Nathan Maves wrote on 08.4.10 11:50 AM:
>>
>>> You could always use an app server that reloads it for you :)
>>  >
>>  > I think resin can do this.
>>  >
>>  > On Wed, Apr 9, 2008 at 7:10 PM, Iwao AVE! <[EMAIL PROTECTED]
>>
>>> <mailto:[EMAIL PROTECTED]>> wrote:
>>  >
>>  >     Hi Roland,
>>  >
>>  >     Haven't tried with JBoss, but I use the following class and JSP to
>>  >     reload resource bundles.
>>  >     After updating .properties files, I call the JSP with my browser.
>>  >
>>  >     It is a kind of hack (and not 'auto'), but useful during development.
>>  >
>>  >     - Java class -
>>  >
>>  >     package util;
>>  >
>>  >     import java.lang.reflect.Field;
>>  >     import java.lang.reflect.InvocationTargetException;
>>  >     import java.lang.reflect.Method;
>>  >     import java.util.ResourceBundle;
>>  >
>>  >     public class ReloadBundle
>>  >     {
>>  >     public static void reloadBundles()
>>  >     {
>>  >     try
>>  >     {
>>  >      clearMap(ResourceBundle.class, null, "cacheList");
>>  >      clearTomcatCache();
>>  >     }
>>  >     catch (Exception e)
>>  >     {
>>  >      System.out.println("Could not reload resource bundles" + e.getMessage
>>  >     ());
>>  >     }
>>  >     }
>>  >
>>  >     private static void clearTomcatCache()
>>  >     {
>>  >     ClassLoader loader = Thread.currentThread().getContextClassLoader();
>>  >     Class<?> cl = loader.getClass();
>>  >
>>  >     try
>>  >     {
>>  >      if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName
>>  >     ()))
>>  >      {
>>  >        clearMap(cl, loader, "resourceEntries");
>>  >      }
>>  >      else
>>  >      {
>>  >        System.out.println("class loader " + cl.getName() + " is not
>>  >     tomcat loader.");
>>  >      }
>>  >     }
>>  >     catch (Exception e)
>>  >     {
>>  >      System.out.println("couldn't clear tomcat cache" + e.getMessage());
>>  >     }
>>  >     }
>>  >
>>  >     private static void clearMap(Class<?> cl, Object obj, String name)
>>  >     throws NoSuchFieldException, IllegalAccessException,
>>  >     NoSuchMethodException,
>>  >     InvocationTargetException
>>  >     {
>>  >     Field field = cl.getDeclaredField(name);
>>  >     field.setAccessible(true);
>>  >
>>  >     Object cache = field.get(obj);
>>  >     Class<? extends Object> ccl = cache.getClass();
>>  >     Method clearMethod = ccl.getMethod("clear", (Class[])null);
>>  >     clearMethod.invoke(cache, (Object[])null);
>>  >     }
>>  >     }
>>  >
>>  >     - JSP -
>>  >
>>  >     <[EMAIL PROTECTED] import="util.ReloadBundle"%>
>>  >     <%
>>  >     ReloadBundle.reloadBundles();
>>  >     %>
>>  >     <html>
>>  >     <head><title>Reload ResourceBundle</title></head>
>>  >     <body>Done</body>
>>  >     </html>
>>  >
>>  >     --
>>  >     Hope this helps,
>>  >     Iwao
>>  >
>>  >     2008/4/9 Roland Bali <[EMAIL PROTECTED]
>>
>>>     <mailto:[EMAIL PROTECTED]>>:
>>>      > Hi,
>>  >      >
>>  >      > I'm using Eclipse and JBoss for my development and everything
>>  >      > is updated automagically during development except the
>>  >      > StripesResources.properties file that require a restart.
>>  >      >
>>  >      > Is there a way of making StripesResources.properties reloadable
>>  >      > during development?
>>  >      >
>>  >      > Kind regards,
>>  >      > Roland

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to