Hi there. I have a Java web application which manages data for many clubs. I would like the application to show club information depending on the URL that is typed in.
Eg. If you enter "localhost:8080/MyApp/Club1" ...then the app should strip out the end of the requst url (Club1), do a lookup in the database for the club, and add this to the session. Then all database requests can look up data depending on which club is in the session.
If you enter "localhost:8080/MyApp/Club2", you get club to registered in the session, and all database requests are for club 2.
The way I thought I may do this is to use a servlet filter that calls HTTPServletRequest().getRequestURL(), and strips out the club name from the request url, to lookup the club from the database.
But then I wan't to change the request URL to be http://localhost%3A8080/MyApp so that the application works as normal. However, I don't think I am able to do this?
Anyone any ideas of how to do this, or if there is a better approach?