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

**URL:** <https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [October 22, 2019, 6:16pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508 "2019-10-22T18:16:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tausif](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tausif](https://community.bloomreach.com/u/tausif)\
**Post date:** [October 22, 2019, 6:16pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/1 "2019-10-22T18:16:13Z")

</div>

Hello,

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.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/c40df590c7e632e896030c24e289fe1cb3aa29ee.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [October 22, 2019, 7:28pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/2 "2019-10-22T19:28:24Z")

</div>

You should be able to use the following

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

---

<div class="post-metadata">

**Author:** ![tausif](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tausif](https://community.bloomreach.com/u/tausif)\
**Post date:** [October 22, 2019, 8:05pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/3 "2019-10-22T20:05:58Z")

</div>

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:

```
getSession()
.getRootNode()
.getNode("content/documents/administration/configuration")
.getNode("url.configurations")

```

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.

---

<div class="post-metadata">

**Author:** ![tausif](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tausif](https://community.bloomreach.com/u/tausif)\
**Post date:** [October 22, 2019, 8:51pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/4 "2019-10-22T20:51:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [October 23, 2019, 7:07am UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/5 "2019-10-23T07:07:46Z")

</div>

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:

```auto
            final ResourceBundleRegistry resourceBundleRegistry =
                    HstServices.getComponentManager().getComponent(ResourceBundleRegistry.class.getName());

            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.

Regards,

Woonsan

---

<div class="post-metadata">

**Author:** ![tausif](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tausif](https://community.bloomreach.com/u/tausif)\
**Post date:** [October 23, 2019, 5:27pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/6 "2019-10-23T17:27:03Z")

</div>

Oh wow, awesome. Let me try that 🙂

---

<div class="post-metadata">

**Author:** ![tausif](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tausif](https://community.bloomreach.com/u/tausif)\
**Post date:** [October 25, 2019, 5:58pm UTC](https://community.bloomreach.com/t/how-to-read-resource-bundle-under-administation-folder-using-java/1508/7 "2019-10-25T17:58:28Z")

</div>

Fantastic! Works really well!
