Flexible URLs

Submitted by toby78 on Tue, 2008-07-08 12:55.Feature Requests

It would be really good if there was a way to overwrite/replace the URL encoding and decoding behaviour...

At the moment it looks like that:

/search.do?indexName=freedb&q=some+keywords

I made a RewriteRule like that:

^/([a-z_]+)-([0-9]+).html$
/search.do?indexName=test&templateName=freedb&q=$1&start=$2

so the new URL should be:

/some_keywords_blablabla-23.html

which should be like:

/search.do?indexName=freedb&q=some_keywords_blablabla&start=690

However I need to do the following now:

1. replace the "_" characters before it is processed the the search action.

2. Do a: start = ($page-1)*30 for the correct page number.

Please let me know how this could be done!

Thanks!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Submitted by will on Tue, 2008-07-08 13:14.

Looks like you need a URL Rewrite solution for a J2EE application.

This should be what you need:

 http://tuckey.org/urlrewrite/

Basically it's a filter in front of DBSight, and you should be able to do any tricks you want.

Submitted by toby78 on Tue, 2008-07-08 13:54.

Yes, that's what I am using.

BUT:

The queries needs to be decoded before the SearchAction reads the q-parameter....(and also the page-number...instead of the start parameter).

Otherwise "some_query" would be passed instead of "some query"

Submitted by will on Tue, 2008-07-08 15:05.

May have to use the <run> tag in the url rewrite configuration.

I think the easiest way would be using your own servlet filter to resolve this more complicated case.