[英]what is the right way to do http request from within tomcat server
i have tomcat server that holds web application i like to be able to call http requests from within this web application to other http server . 我有tomcat服务器,它拥有Web应用程序,我喜欢能够从这个Web应用程序中调用http请求到其他http服务器。 what is the right way doing it ?
这样做的正确方法是什么?
another impotent thing is that the web application needs to call multiple http request. 另一个无能为力的事情是Web应用程序需要调用多个http请求。 so i guess i need to use thread pool .
所以我想我需要使用线程池。
can tomcat give me thread pool or i need to build one . 可以tomcat给我线程池或我需要构建一个。
Use the commons-httpclient . 使用commons-httpclient 。 For thread pool use the ExecutorService support provided in java 5.0.
对于线程池,请使用java 5.0中提供的ExecutorService支持。
It is same as how you would make http calls in any regular java app - running it in tomcat doesn't make it easier or difficult. 它与在任何常规Java应用程序中进行http调用的方式相同 - 在tomcat中运行它不会使它变得更容易或更困难。
我建议使用像HttpClient或类似的东西,而不是使用原始Java API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.