Reply To: add Rule realy dynamic

Splash Forums Rewrite Users add Rule realy dynamic Reply To: add Rule realy dynamic

#25230

captainmorgan
Participant

Lincoln, I’m trying to do something similar. I have a page table in the database and there are up to 10 different XHTML pages that these could map to.
Would something like the following work? From my understanding, every URL would be evaluated, if the current URL is found in the database, it is mapped to page1.hxml.
I will have thousands of pages and don’t really want to create a massive configuration.

@Override
public Configuration getConfiguration( ServletContext context ) {

ConfigurationBuilder builder = ConfigurationBuilder.begin();

.addRule(Join.path(“{page}”).to(“/page1.xhtml”))
.where(new HttpCondition() {
public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
{
String page = How to I get the page URL here?

// Perform database lookup of page URL.
}
})

return builder;
}
`

  • This reply was modified 8 years, 3 months ago by  captainmorgan.