Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Message Bundles

 
R Ben Parsons
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is there a way to externalize message bundles so that a change to a value doesn't mean re-deploying the WAR or re-starting the application server? Maybe some sort of dynamic HTTP include approach?

Thanks,

Ben.
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello R,

As opposed to externalizing the message bundle, what I have done in the past is put a FileWatchDog on it, monitoring it for any changes. Admitidly I haven't doen this for JSF, so don't know how you would tell JSF about it. But it should be possible. I'll check it out and let you know.
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not as easy as it might seem....

<f:loadBundle uses ResourceBundle to load the bundle. This is turn uses a cache. So each time you get to the page where you are referencing your resource bundle, you are in fact asking ResourceBundle to give you a new Bundle. ie


But, Resource bundle get the original properties file off its cache. There doesn't seem to be a workaround for this. I found a post that mentioned to access the cache and clear through reflection, and tried it but that didn't work for me. Maybe, with whatever you're doing, it works for you.



Hope this helps.

cheers
Darryl
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic