XQueryURLRewrite is a very convenient and simple way to separate the request URL format from the inner xquery implementation structure.
The way it is implemented in a single xquery file where the URL is checked against number patterns in a long if-then-else statement could be convenient for a simple cases,with small number of applications on a single server.
If we have a project with multiple applications, developed by a number of teams it will be not practical to keep the logic for all URL redirection rules in a single file and it will be a single point of failure for the whole server if somebody misspells a command in controller.xql file.
I would like to propose a small extension in the logic of how XQueryURLRewrite finds the file with redirection rules.
The idea is to search for controller.xql first in the sub-directories matching the URL structure and if not such file is found then execute the main webapp/controller.xql.
1. We can have controller.xql ( or whatever reserved name we choose) in any directory under webapp.
2. XQueryURLRewrite will try to interpret every part of the URL separated by slash as a directory from webapp down, looking for controller.xql file in this directory.
3. If controller.xql is found then use it, respecting all relative paths to the directory where controller.xql was found.
4. If not then try to interpret next part of the URL as a directory.
5. When we add the next part of the URL and the path points to a non exiting directory, then we use webapp/controller.xql
I believe this approach of separating redirection rules by application will make the development and maintenance simpler and more robust.
When we install an application WAR file, all redirections will work automatically, because the application will come with its own controller.xql.
When we remove the application all relevant redirections will go as well and all this will happen without need to touch webapp/controller.xql at all.
Then webapp/controller.xql will be used for same very generic cases of redirection.
I hope this will be of any help.
Regards,
Tom
------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open