How To Read Resource Bundle Under "administation" Folder Using Java


Is there a way (using Java) to read resource bundles under the administration folder if I only know the path or id of the bundle? Please see the screenshot below, these are the resource bundles that I want to get the contents of.


You should be able to use the following

org.hippoecm.hst.resourcebundle.ResourceBundleUtils#getBundle(String basename, Locale locale, boolean fallbackToJavaResourceBundle)

Hi Jasper,

Thank you for the response. I did try it, but for some reason it wasn’t working. On debugging it appears that it doesn’t have the request context and so it is unable to lookup the document. I am able to get to the document node by querying it this way:


Here, “url.configurations” is the id of the resource bundle. Now, I’m trying to figure out how to get the content (and properties) from the node.

I figured out how to get the HippoDocument from the node. The only issue I have now is how to get the RequestContext from a J2EE Filter.

Assuming that (a) you have some reason to execute your servlet filter before the HstFilter is executed and (b) it is fine to read only ‘live’ content of the resource bundle, you can possibly try this:

            final ResourceBundleRegistry resourceBundleRegistry =

            if (resourceBundleRegistry != null) {
                if (locale == null) {
                    bundle = resourceBundleRegistry.getBundle(basename);
                } else {
                    bundle = resourceBundleRegistry.getBundle(basename, locale);

where locale is the local you want to use from the bundle and basename is the resource bundle id.



1 Like

Oh wow, awesome. Let me try that :slight_smile:

Fantastic! Works really well!