• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to set different dir to resource bundle file

 
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any way to configure tomcat see ResourceBundle files other then in the WEB-INF\classes directory?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
ben josh
Ranch Hand
Posts: 620
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic