I know my “problem” or the way I want this to work might not be a common approach, but I hope someone can point me in the right direction.
I am still messing with a self written java server (let’s call it “myserver”). But I kinda just want it to validate whether a user is allowed to access the servlet he is requesting.
I am doing following: The user calls myserver. Here a login-form is called and the user logs in. The data is checked.
NOW: If the user is allowed to access the content I want him redirected to tomcat behind myserver to handle the servlet-requests.
My question: How can I redirect the request from myserver to tomcat? Is there a java-way?
Thanx in advance.
… dg
You could use some java HTTP client or a TCP port forwarder and forward all request coming to your server to the real tomcat server.
Update:
Here you can find a servlet I used couple of years ago. You could possibly use it as starting point.
So for example, you programmatically create a forwarding to the tomcat server and when the user is allowed to pass through, send it the forwarder’s port number.