Hi Steinar

A few years ago I implemented a servlet filter to handle CORS. The filter
was a DS component and it accepted a configuration via activate. Everytime
the config was changed, it would restart and update the filter.
You can also have the DS component implement the filter interface and an
auxiliary service interface with a method to force a reload of the config
without restarting.
I guess it depends on how you supply the configuration to the filter.

Regards,
João Assunção





On Fri, Mar 15, 2024 at 4:38 PM Steinar Bang <[email protected]> wrote:

> I have this bundle:
>  https://github.com/steinarb/oldalbum/tree/master/oldalbum.web.security
>
> which contains two DS/SCR components:
>
>  1. A component implementing ServletContextHelper used to define the
>     servlet context
>
> https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumServletContextHelper.java
>
>  2. A component implementing a Shiro servlet Filter
>
> https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumShiroFilter.java#L35
>
> I would like to reload the shiro servlet filter programmatically when
> its configuration changes.
>
> What's the best way of doing that?
>
> Reload the entire bundle?
>
> Reload just the filter component?
>
> Make the filter reinitialize itself without reloading?
>
> Has anyone done anything similar?
>
> Suggestions? Ideas? All are welcome!
>
> Thanks!
>
>
> - Steinar
>
>

Reply via email to