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]> 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]>:
> > 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to