使用自定义标头将页面控制从Liberty应用程序发送到WebSphere应用程序

时间:2016-09-30 06:06:59

标签: javascript ajax httprequest websphere-8 websphere-liberty

我们需要从WebSphere Liberty中使用Custom头部署的Application B中调用部署在WebSphere Application Server中的应用程序A.两台服务器位于同一个域但主机不同。我无法使用reponse.sendRedirect()window.location,因为他们会创建新请求。 RequestDispatcher.forward用于本地资源。

例如, 我有申请:https://host1.domain.com/LibertyApp1/index.jsp

这会加载一个JavaScript,我需要在host2.domain.com中调用WasApp1。

我的JavaScript看起来像这样:

function callWAS(token) {
    var request = new XMLHttpRequest();
    var path = "https://host2.domain.com/WasApp1/SimpleServlet";
    request.open("POST",path,true);
    request.setRequestHeader("Authorization",token);
    request.send(null);
}

token是我需要在Authorization标头中设置的String。

当执行JavaScript时,它正在创建一个飞行前请求,POSTOPTIONS请求都提供状态200.但页面控件仍然使用LibertyApp1。我希望页面控件与WasApp1一起使用。有没有办法可以使用自定义的http请求标头将请求转发给WasApp1?

0 个答案:

没有答案