My application currently consists of one servlet using a UIProvider. This UIProvider selects correct UI by looking at the path in the request. Now I would need to redirect the user (say, by pressing a button) to another UI. That is, I would like to redirect the user to another URL handled by the same servlet.
So, currently the path to my main UI is
http://host/myContextRoot/myApp/pathForUI
How can I redirect the user to
http://host/myContextRoot/myApp/pathForAnotherUI
without hard coding anything but the ‘pathForAnotherUI’ part? I can get the context root through servlet, but how to get the mapped path of the servlet (ie. ‘myApp’ here). I was thinking about using Page.setLocation() if I can manage to get the correct path, but is there some other way to do this?