我在jboss容器中部署了两个应用程序(相同的unix框).如果我从app1收到请求,我需要为app2设置相应的请求.
例如:
如果app1请求是:http://example.com/context? param1 = 123
然后我需要提取" http://example.com/ ",以便我可以构建第二个应用程序的请求.
我试过用:
HttpServletRequest.getServerName() &
HttpServletRequest.getServerPort() & \
HttpServletRequest.getHeader("host")
Run Code Online (Sandbox Code Playgroud)
方法,但请求可能是http或https.
如果还有其他更好的方法,请告诉我.谢谢!