Runtime rewriting configuration

Splash Forums Rewrite Users Runtime rewriting configuration

This topic contains 9 replies, has 2 voices, and was last updated by  Christian Kaltepoth 7 years, 3 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #26401


    I’m developing a web application that provides some pages. I require to rewrite the URL of these pages and I would like to use this framework ocpsoft rewrite.

    All works fine, but the problem is that I need invoke the configuration in a particular moment of startup so I can send a list of link to be rewrited.

    I know that is possible but I haven’t some experience with this framework..

    Thakns for all Bye.


    If you implement a ConfigurationProvider you can do whatever you want to build the rules. You could for example load data from a database or something like that. There should be no problem with doing so.



    Thanks for good answer,
    But the problem is that I use a startup class for initialize the webapp, this class will start a connection pool, then only after this moment can be performed actions to the DB.

    So the problem is how can I be sure that the class “HttpConfigurationProvider” is started after my startup class?

    Thanks in advance


    This depends on how you create/bootstrap your startup class. 😉

    Rewrite initialization is performed, when RewriteFilter.init() is called by the container. And I think there is now way to change this.



    Can you show me the way please?


    Just have a look at chapter 2 of the installation guide. It describes in detail how to setup your first ConfigurationProvider.

    Feel free to ask if you have any specific questions.



    Yes mate I know how to write this ConfigurationProvider…
    But i don’t know how to start it myself in my startup class…


    You cannot start it yourself. As I said, Rewrite is initialized by the RewriteFilter. Whenever the container initializes the Servlet filters, Rewrite will start up.

    Could you tell more about your startup class? How is it initialized?



    yes of course,
    The startup class is an implementations of ServletContextListener, and start the connection pool, the config for log4j and other minor configs.


    I think Rewrite will initialize before any ServletContextListeners, so your startup class won’t be ready when Rewrite initializes.

    If you really need the startup class for Rewrite configuration, you should find some other way of initialization. If you are using CDI or Spring, there are many better ways to do this compared to a ServletContextListeners. And manually setting up a connection pool is also not very common. This should be done by the container which will take care of preparing it before the application is deployed.

    If you show me the code of your startup class, I could try to give some thoughts for improvement.

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

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

Comments are closed.