Multiple rewrite url value from database

Splash Forums Rewrite Users Multiple rewrite url value from database

This topic contains 10 replies, has 4 voices, and was last updated by  MFCN 6 years, 9 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #26865


    Hi all,

    I’m new in “rewrite”. I have project with Spring and Primefaces. I’ve successfully configured rewrite and it works great!. My case now, I stored my url value in database (ex: all *.faces), and want all of them rewritten by ConfigurationProvider. Is it possible to multiple .addrule, let’s say something like this:

    for (){
       .addRule(Join.path(rewrite_url_from_db_1).to(string_url_from_db_1)) ...

    Is there any way to solve it?.

    Thanks for kind response.


    Sure, just don’t chain the calls to ‘addRule()’ and instead do something like:

    ConfigurationBuilder builder = ConfigurationBuilder.begin();
    for( ... ) {




    Thanks a lot Christian! :), indeed helpful ^^.



    Hi all.

    In my application there is a form for maintenance of the system url. I need to update the Configuration when I make a chage in this register. I’ve done an implementation of HttpConfigurationCacheProvider with an observer method that is called when an event is triggered, this one set a boolean to reload the Configuration, but the getConfiguration is not called again.

    How can I do this?


    The configuration is created only once at application startup. So instead you should create a custom condition which detects the mode you are in. In this case you won’t need to change the configuration at runtime.



    Can you show me an example, please? Remembering that my rules are persisted in a database.


    I was thinking about something like this:

    ConfigurationBuilder builder = ConfigurationBuilder.begin();
    for( ... ) {
          .when(new HttpCondition() {
               public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
                  // check for maintenance mode


    I think I was not clear in my explanation. The form is designed to map the .xhtml files to url‘s, for example:

    I have a ../pages/admin/index.xhtml file, in the form we register the url /admin to that file.

    The question is when I update the url of that page to /administration, at that time I would like to update the cache or ConfigurationProvider.


    Not sure what that best way to handle this requirement is. There is a ConfigurationCacheProvider SPI that (by default) caches the configuration forever.


    Default implementation:

    You could register your own implementation that basically disables caching or forces configuration reloading at certain events. I guess you will have a look at the source. 🙂


    Christian is right, you probably want to either trigger a purge of the the ServletContext configuration cache:

    context.put(ServletContextConfigurationCacheProvider.class.getName() + "_cachedConfig", null)

    Or… you can implement your own HttpConfigurationCacheProvider and register it as documented here:

    (Just make sure the priority is set to a lower number than the existing ServletContext cache provider’s priority (to override it.)

    However, in order for this to work, you will also need to disable the ServletContext cache entirely:





    Thanks a lot Christian and Lincoln, all works perfectly.

Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.