I put all my application properties and configuration into a hippo resource bundle and (based on the channel) into the channel settings (ChannelInfo).
Is there any way to access the channel configuration and hippo resource bundles from a ServletFilter?
I am using a SpringSecurityFilter and I need access to those configuration items.
Regards
EDIT In the HsTDelegateeFilterBean#doFilter the current hstRequestContext is put into the ServletRequest (as an attribute) but unfortunately it is removed after the execution of the doFilter method.
You can copy some code from ResourceBundleUtils.java [1]. For example,
ResourceBundleRegistry resourceBundleRegistry = HstServices.getComponentManager().getComponent(ResourceBundleRegistry.class.getName());
String basename = "com.example.Messages";
ResourceBundle bundle = resourceBundleRegistry.getBundle(basename));
This will be good enough for your use case if you want to get it in Spring Security filters. You're accessing the HST container's singleton component directly above.
I think your last question is a different topic, but the lifecycle of HstRequestContext instance is basically in request-scope. So you won't be able to store it for later use. Also, Spring Security filter is supposed to be located before HstFitler. That means you cannot get access to HstRequestContext instance anyway because it's created by HstFilter. If you want to have a servlet or servlet filter to get access to HstRequestContext after HstFilter in other use cases, you might want to look at [2].
[1] http://svn.onehippo.org/repos/hippo/hippo-cms7/site-toolkit/trunk/commons/src/main/java/org/hippoecm/hst/resourcebundle/ResourceBundleUtils.java [2] http://www.onehippo.org/library/concepts/integration/hst-container-integration-with-other-web-application-frameworks.html