• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to set different dir to resource bundle file

 
Meir Yan
Ranch Hand
Posts: 599
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way to configure tomcat see ResourceBundle files other then in the WEB-INF\classes directory?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resource bundles are found in the JVM classloaders classpath.
You could bundle them into jars and put them under WEB-INF/lib.

Where do you want to put them?
 
Meir Yan
Ranch Hand
Posts: 599
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will like to but them in directory in my webapp
something like : webapps\myApp\include
so I need to add this dir to my classpath?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat ignores your classpath.
It finds resources by looking in a series of directories.

This is why we need to put them in the classes directory or in a jar file under the lib directory.
 
Gabriele Muscas
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i've create a custom class loader.



From my code, i get the classloader and call the addCustomRepositoryOrLocation method but ResourceBundle not works...



Search in progress...

Bye

 
Tim Holloway
Saloon Keeper
Pie
Posts: 17620
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A) It's not WEB-INF\classes, it's WEB-INF/classes. A true WAR is a ZIP file, not a directory and you use DOS pathname separators at your peril, since Java would much rather interpret them as escape character.

B) You DO realize that if you don't put resources under WEB-INF, anyone who wants to can potentially retrieve them by URL (and in fact, WILL be able to, by default). Which is a potential security exploit.

C) What benefit is kludging up a custom classpath going to gain you here anyway?
 
Gabriele Muscas
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
i would like to create differents directories in which put the properties files.



Now, I'm trying ResourceBundleThemeSource with the Spring framework, but the problem is with the JVM.

I continue to seek a solution.

Thanks,
Gabriele
 
Gabriele Muscas
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this works for me:



In the class loader i've this code:


So, my problem is a spring problem.

Bye,
Gabriele
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic