2525package org .aoju .bus .office .bridge ;
2626
2727import org .aoju .bus .core .lang .Assert ;
28- import org .aoju .bus .core .lang .Http ;
2928import org .aoju .bus .core .lang .Symbol ;
3029import org .aoju .bus .core .lang .exception .InstrumentException ;
3130import org .aoju .bus .core .utils .ClassUtils ;
3231import org .aoju .bus .core .utils .StringUtils ;
33- import org .aoju .bus .http .Httpx ;
3432import org .aoju .bus .office .builtin .MadeInOffice ;
3533import org .aoju .bus .office .metric .AbstractOfficeEntryManager ;
3634import org .aoju .bus .office .metric .RequestBuilder ;
3735
38- import javax .net .ssl .HostnameVerifier ;
39- import javax .net .ssl .SSLContext ;
40- import javax .net .ssl .SSLSocketFactory ;
41- import javax .net .ssl .TrustManager ;
4236import java .io .File ;
43- import java .io .FileInputStream ;
4437import java .io .FileNotFoundException ;
4538import java .io .IOException ;
4639import java .net .MalformedURLException ;
4740import java .net .URI ;
4841import java .net .URISyntaxException ;
4942import java .net .URL ;
50- import java .security .*;
51- import java .security .cert .CertificateException ;
52- import java .security .cert .X509Certificate ;
5343
5444/**
5545 * 负责执行通过不依赖于office安装的{@link OnlineOfficePoolManager}提交的任务。
@@ -106,32 +96,6 @@ private static File getFile(final String resourceLocation) throws FileNotFoundEx
10696 }
10797 }
10898
109- /**
110- * Https SSL证书
111- *
112- * @param X509TrustManager 证书信息
113- * @return SSLSocketFactory 安全套接字
114- */
115- private static SSLSocketFactory createTrustAllSSLFactory (X509TrustManager X509TrustManager ) {
116- try {
117- SSLContext sc = SSLContext .getInstance (Http .TLS );
118- sc .init (null , new TrustManager []{X509TrustManager }, new SecureRandom ());
119- return sc .getSocketFactory ();
120- } catch (Exception ignored ) {
121- ignored .printStackTrace ();
122- }
123- return null ;
124- }
125-
126- /**
127- * 获取 HostnameVerifier
128- *
129- * @return the object
130- */
131- private static HostnameVerifier createTrustAllHostnameVerifier () {
132- return (hostname , session ) -> true ;
133- }
134-
13599 private String buildUrl (final String connectionUrl ) throws MalformedURLException {
136100 final URL url = new URL (connectionUrl );
137101 final String path = url .toExternalForm ().toLowerCase ();
@@ -151,7 +115,7 @@ protected void doExecute(final MadeInOffice task) throws InstrumentException {
151115 buildUrl (connectionUrl ),
152116 Math .toIntExact (config .getTaskExecutionTimeout ()),
153117 Math .toIntExact (config .getTaskExecutionTimeout ()));
154- task .execute (new OnlineOfficeBridgeFactory (new Httpx (), requestBuilder ));
118+ task .execute (new OnlineOfficeBridgeFactory (requestBuilder ));
155119
156120 } catch (IOException ex ) {
157121 throw new InstrumentException ("Unable to create the HTTP client" , ex );
@@ -168,50 +132,4 @@ protected void doStop() throws InstrumentException {
168132 // Nothing to stop here.
169133 }
170134
171- private KeyStore loadStore (
172- final String store ,
173- final String storePassword ,
174- final String storeType ,
175- final String storeProvider )
176- throws NoSuchAlgorithmException , CertificateException , IOException , KeyStoreException ,
177- NoSuchProviderException {
178-
179- if (store != null ) {
180- Assert .notNull (storePassword , "The password of store {0} must not be null" , store );
181-
182- KeyStore keyStore ;
183-
184- final String type = storeType == null ? KeyStore .getDefaultType () : storeType ;
185- if (storeProvider == null ) {
186- keyStore = KeyStore .getInstance (type );
187- } else {
188- keyStore = KeyStore .getInstance (type , storeProvider );
189- }
190-
191- try (FileInputStream instream = new FileInputStream (getFile (store ))) {
192- keyStore .load (instream , storePassword .toCharArray ());
193- }
194-
195- return keyStore ;
196- }
197- return null ;
198- }
199-
200- private static class X509TrustManager implements javax .net .ssl .X509TrustManager {
201-
202- @ Override
203- public void checkClientTrusted (X509Certificate [] chain , String authType ) {
204- }
205-
206- @ Override
207- public void checkServerTrusted (X509Certificate [] chain , String authType ) {
208- }
209-
210- @ Override
211- public X509Certificate [] getAcceptedIssuers () {
212- return new X509Certificate [0 ];
213- }
214-
215- }
216-
217135}
0 commit comments