简体   繁体   English

从tomcat服务器中执行http请求的正确方法是什么

[英]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.

相关问题 在服务器HTTP请求中执行mongo map-reduce的推荐方法是什么? - What is the recommended way to do mongo map-reduce from within an server http request? 从服务器端处理条件HTTP GET请求的好方法是什么? 也就是说,包含“ If-Modified-Since”标头的GET请求? - What is a good way to handle a conditional HTTP GET request from the server-side? That is, a GET request containing “If-Modified-Since” header? 如何在Apache Tomcat服务器上用密码保护HTTP Get请求? - How do I password protect an HTTP Get Request on my Apache Tomcat server? 从junit拦截HTTP调用的最简单方法是什么? - what's the simplest way to intercept http calls from within a junit? 从Java程序发出HTTP请求的最佳方法是什么? - What is the best way to make an HTTP request from a Java program? 当请求到Tomcat服务器时会发生什么? - What happens when request comes to Tomcat server? 试图将 http 请求从 Tomcat servlet 发送到另一台服务器,卡在 HttpClientBuilder.create().build(); - Trying to send http request from Tomcat servlet to another server, Stuck on HttpClientBuilder.create().build(); 如何将请求从tomcat服务器重定向到另一个tomcat服务器 - How to redirect the request from tomcat server to another tomcat server Tomcat:HTTP Multipart请求被中断时会发生什么? - Tomcat: what happens when a HTTP Multipart request gets interrupted? 正在使用Tomcat服务器端口…现在要做什么 - Tomcat Server ports in use…what to do now
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM