//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.eviware.soapui.impl.wsdl.support.http;
import com.eviware.soapui.SoapUI;
import com.eviware.soapui.impl.wsdl.submit.transports.http.ExtendedHttpMethod;
import com.eviware.soapui.impl.wsdl.submit.transports.http.support.metrics.SoapUIMetrics;
import com.eviware.soapui.impl.wsdl.support.CompressionSupport;
import com.eviware.soapui.impl.wsdl.support.http.HeaderRequestInterceptor;
import com.eviware.soapui.impl.wsdl.support.http.OverridableProxySelectorRoutePlanner;
import com.eviware.soapui.impl.wsdl.support.http.ProxyUtils;
import com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager;
import com.eviware.soapui.impl.wsdl.support.http.SoapUISSLSocketFactory;
import com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager.SoapUIBasicPooledConnAdapter;
import com.eviware.soapui.model.propertyexpansion.PropertyExpander;
import com.eviware.soapui.model.settings.Settings;
import com.eviware.soapui.model.settings.SettingsListener;
import com.eviware.soapui.settings.HttpSettings;
import com.eviware.soapui.settings.SSLSettings;
import java.io.File;
import java.io.IOException;
import java.net.ProxySelector;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import org.apache.commons.ssl.KeyMaterial;
import org.apache.http.Header;
import org.apache.http.HttpClientConnection;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.RequestWrapper;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpProcessor;
import org.apache.http.protocol.HttpRequestExecutor;
import org.apache.log4j.Logger;
public class HttpClientSupport {
private static final HttpClientSupport.Helper helper = new HttpClientSupport.Helper();
static {
if(PropertyExpander.getDefaultExpander() == null) {
SoapUI.log.warn("Default property expander was null - will set global proxy later");
} else {
ProxyUtils.setGlobalProxy(SoapUI.getSettings());
}
}
public HttpClientSupport() {
}
public static HttpClientSupport.SoapUIHttpClient getHttpClient() {
return helper.getHttpClient();
}
public static void setProxySelector(ProxySelector proxySelector) {
getHttpClient().setRoutePlanner(new OverridableProxySelectorRoutePlanner(helper.getRegistry(), proxySelector));
}
public static HttpResponse execute(ExtendedHttpMethod method, HttpContext httpContext) throws ClientProtocolException, IOException {
return helper.execute(method, httpContext);
}
public static HttpResponse execute(ExtendedHttpMethod method) throws ClientProtocolException, IOException {
return helper.execute(method);
}
public static void applyHttpSettings(HttpRequest httpMethod, Settings settings) {
String userAgent = settings.getString(HttpSettings.USER_AGENT, (String)null);
if(userAgent != null && userAgent.length() > 0) {
httpMethod.setHeader("User-Agent", userAgent);
}
long timeout = settings.getLong(HttpSettings.SOCKET_TIMEOUT, 60000L);
httpMethod.getParams().setParameter("http.socket.timeout", Integer.valueOf((int)timeout));
}
public static String getResponseCompressionType(HttpResponse httpResponse) {
Header contentType = null;
if(httpResponse.getEntity() != null) {
contentType = httpResponse.getEntity().getContentType();
}
Header contentEncoding = null;
if(httpResponse.getEntity() != null) {
contentEncoding = httpResponse.getEntity().getContentEncoding();
}
return getCompressionType(contentType == null?null:contentType.getValue(), contentEncoding == null?null:contentEncoding.getValue());
}
public static String getCompressionType(String contentType, String contentEncoding) {
String compressionAlg = contentType == null?null:CompressionSupport.getAvailableAlgorithm(contentType);
return compressionAlg != null?compressionAlg:(contentEncoding == null?null:CompressionSupport.getAvailableAlgorithm(contentEncoding));
}
public static void addSSLListener(Settings settings) {
HttpClientSupport.Helper var10003 = helper;
helper.getClass();
settings.addSettingsListener(var10003.new SSLSettingsListener());
}
public static BasicHttpContext createEmptyContext() {
BasicHttpContext httpContext = new BasicHttpContext();
// BasicCookieStore cookieStore = new BasicCookieStore();
//httpContext.setAttribute("http.cookie-store", cookieStore);
return httpContext;
}
private static class Helper {
private final HttpClientSupport.SoapUIHttpClient httpClient;
private static final Logger log = Logger.getLogger(HttpClientSupport.Helper.class);
private final SoapUIMultiThreadedHttpConnectionManager connectionManager;
private final SchemeRegistry registry;
public Helper() {
Settings settings = SoapUI.getSettings();
this.registry = new SchemeRegistry();
this.registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
try {
SoapUISSLSocketFactory e = this.initSocketFactory();
this.registry.register(new Scheme("https", 443, e));
} catch (Throwable var3) {
SoapUI.logError(var3);
}
this.connectionManager = new SoapUIMultiThreadedHttpConnectionManager(this.registry);
this.connectionManager.setMaxTotal((int)settings.getLong(HttpSettings.MAX_TOTAL_CONNECTIONS, 2000L));
this.connectionManager.setDefaultMaxPerRoute((int)settings.getLong(HttpSettings.MAX_CONNECTIONS_PER_HOST, 500L));
this.httpClient = new HttpClientSupport.SoapUIHttpClient(this.connectionManager);
this.httpClient.addRequestInterceptor(new HeaderRequestInterceptor(), this.httpClient.getRequestInterceptorCount());
settings.addSettingsListener(new HttpClientSupport.Helper.SSLSettingsListener());
}
public HttpClientSupport.SoapUIHttpClient getHttpClient() {
return this.httpClient;
}
private SchemeRegistry getRegistry() {
return this.registry;
}
public HttpResponse execute(ExtendedHttpMethod method, HttpContext httpContext) throws ClientProtocolException, IOException {
method.afterWriteRequest();
if(method.getMetrics() != null) {
method.getMetrics().getConnectTimer().start();
}
HttpResponse httpResponse = this.httpClient.execute(method, httpContext);
method.setHttpResponse(httpResponse);
return httpResponse;
}
public HttpResponse execute(ExtendedHttpMethod method) throws ClientProtocolException, IOException {
method.afterWriteRequest();
if(method.getMetrics() != null) {
method.getMetrics().getConnectTimer().start();
}
HttpResponse httpResponse = this.httpClient.execute(method);
method.setHttpRe
没有合适的资源?快使用搜索试试~ 我知道了~
soapui cookie处理方式
共26个文件
class:18个
java:8个
4星 · 超过85%的资源 需积分: 12 166 下载量 131 浏览量
2015-09-30
09:54:34
上传
评论 5
收藏 48KB ZIP 举报
温馨提示
soapUI的http请求不支持cookie保持 改造源码使它支持 内含源码和class,在jdk8下编译 自己来编译(eclipse下新建一个工程,把soapUI的所有jar包 包含进工程就可以编译) 替换soapUI的class文件 替换 soapui-****版本号*****.jar 中对应的class 理论支持所有版本 (readyAPI也支持 ready-api-soapui-***.jar)
资源推荐
资源详情
资源评论
收起资源包目录
soapUI-cookie.zip (26个子文件)
src
sss.java 5KB
com
smartbear
ready
license
LicenseBootstrap.java 5KB
analytics
ReadyApiProductInfo.java 3KB
LicenseManagerServiceFactory.java 3KB
LicenseState.java 2KB
module
ConcurrentXmlLoadProcess.java 8KB
eviware
soapui
impl
wsdl
teststeps
support
http
HttpClientSupport.java 15KB
Soaphttptest.java 11KB
out
SoapUIHttpRequestExecutor.class 4KB
com
smartbear
ready
license
LicenseManagerServiceFactory.class 3KB
analytics
ReadyApiProductInfo.class 4KB
LicenseState.class 2KB
LicenseBootstrap.class 5KB
module
ConcurrentXmlLoadProcess$1.class 1KB
ConcurrentXmlLoadProcess$2.class 837B
ConcurrentXmlLoadProcess.class 7KB
eviware
soapui
impl
wsdl
support
http
HttpClientSupport$Helper$SSLSettingsListener.class 3KB
HttpClientSupport$SoapUIHttpClient.class 1KB
HttpClientSupport$Helper.class 7KB
HttpClientSupport$SoapUIHttpRequestExecutor.class 4KB
HttpClientSupport.class 6KB
Soaphttptest.class 1KB
HttpClientSupport$Helper.class 4KB
SoapUIHttpClient.class 733B
sss.class 5KB
HttpClientSupport.class 4KB
共 26 条
- 1
资源评论
- srwh20002016-10-10非常不错,谢谢楼主!!!!
- 沉默小生2016-01-16东西不错,不过不会反编译修改再生成jar包,头疼……谁来教教?
- qq_355399782018-03-21怎么替换,怎么编译啊~~搞不懂
goas
- 粉丝: 32
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功