HttpClient长连接
@Bean
public VideoStructurizationService getVideoStructurizationService() {
HttpClientLoop.httpLongConnLoop(host);
VideoStructurizationConstant.POST_VEHICLES = new HttpPost(HttpClientLoop.constructURI(schem, host, prefixPath + VideoStructurizationConstant.TYPE_VEHICLES + "/entities"));
VideoStructurizationConstant.POST_NONMOTORS = new HttpPost(HttpClientLoop.constructURI(schem, host, prefixPath + VideoStructurizationConstant.TYPE_NONMOTORS + "/entities"));
VideoStructurizationConstant.POST_PEDESTRIANS = new HttpPost(HttpClientLoop.constructURI(schem, host, prefixPath + VideoStructurizationConstant.TYPE_PEDESTRIANS + "/entities"));
VideoStructurizationConstant.POST_FACES = new HttpPost(HttpClientLoop.constructURI(schem, host, prefixPath + VideoStructurizationConstant.TYPE_FACES + "/entities"));
return VideoStructurizationConstant.GET_VIDEOSTRUCTURIZATIONSERVICE;
}
封装
package com.yymt.common.utils;
import org.apache.http.HeaderElement;
import org.apache.http.HeaderElementIterator;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.c