从自己的java服务器重定向到tomcat [英] redirecting from own java server to tomcat
问题描述
我知道我的问题"或我希望它工作的方式可能不是一种常见的方法,但我希望有人能指出我正确的方向.我仍然在使用自己编写的 Java 服务器(我们称之为myserver").但我只是想让它验证是否允许用户访问他请求的 servlet.我正在执行以下操作:用户调用 myserver.这里调用登录表单,用户登录.检查数据.
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.
现在:如果允许用户访问内容,我希望他重定向到 myserver 后面的 tomcat 以处理 servlet 请求.
NOW: If the user is allowed to access the content I want him redirected to tomcat behind myserver to handle the servlet-requests.
我的问题:如何将请求从 myserver 重定向到 tomcat?有java方式吗?
My question: How can I redirect the request from myserver to tomcat? Is there a java-way?
提前谢谢.
... dg
推荐答案
您可以使用一些 java HTTP 客户端或 TCP 端口转发器,将所有到达您服务器的请求转发到真正的 tomcat 服务器.
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.
更新:此处您可以找到我几年前使用过的 servlet.您可以将其用作起点.例如,您以编程方式创建一个到 tomcat 服务器的转发,当用户被允许通过时,将转发器的端口号发送给它.
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.
这篇关于从自己的java服务器重定向到tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!