简体   繁体   English

在struts动作中间调用远程servlet

[英]Call remote servlet in the middle of a struts action

Is it possible to call a remote servlet in the middle of a struts action and then use its result? 是否可以在struts动作中间调用远程servlet,然后使用其结果?

For instance, say i have two webapps A and B on the same server 例如,假设我在同一服务器上有两个Web应用程序A和B

Webapp A has an action which i would like to do something like: Webapp A有一个动作,我想执行以下操作:

processing
"call" servlet in webapp B
process using response from remote servlet
forward to whatever page is appropriate (success/error/etc)

In my specific example the servlet in webapp B will generate a PDF file which is returned in the response and i need use this pdf file in the further processing in the action in webapp A. 在我的特定示例中,Web应用程序B中的servlet将生成一个PDF文件,该文件将在响应中返回,我需要在Web应用程序A中的操作的进一步处理中使用此pdf文件。

So i would like the call to the servlet to be like calling a method that returns what i need for further processing if possible. 因此,我希望对Servlet的调用就像调用一个方法,该方法在可能的情况下返回我需要的进一步处理。

您可以使用香草HttpURLConnection或更强大的Apache HttpClient Api

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM