1 //
2 //  ========================================================================
3 //  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 //  ------------------------------------------------------------------------
5 //  All rights reserved. This program and the accompanying materials
6 //  are made available under the terms of the Eclipse Public License v1.0
7 //  and Apache License v2.0 which accompanies this distribution.
8 //
9 //      The Eclipse Public License is available at
10 //      http://www.eclipse.org/legal/epl-v10.html
11 //
12 //      The Apache License v2.0 is available at
13 //      http://www.opensource.org/licenses/apache2.0.php
14 //
15 //  You may elect to redistribute this code under either of these licenses.
16 //  ========================================================================
17 //
18 
19 package org.eclipse.jetty.client;
20 
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.net.UnknownHostException;
24 import java.util.Enumeration;
25 import java.util.LinkedList;
26 import java.util.Set;
27 import java.util.concurrent.ConcurrentHashMap;
28 import java.util.concurrent.ConcurrentMap;
29 import javax.net.ssl.SSLContext;
30 
31 import org.eclipse.jetty.client.security.Authentication;
32 import org.eclipse.jetty.client.security.RealmResolver;
33 import org.eclipse.jetty.client.security.SecurityListener;
34 import org.eclipse.jetty.http.HttpBuffers;
35 import org.eclipse.jetty.http.HttpBuffersImpl;
36 import org.eclipse.jetty.http.HttpSchemes;
37 import org.eclipse.jetty.io.Buffers;
38 import org.eclipse.jetty.io.Buffers.Type;
39 import org.eclipse.jetty.util.Attributes;
40 import org.eclipse.jetty.util.AttributesMap;
41 import org.eclipse.jetty.util.component.AggregateLifeCycle;
42 import org.eclipse.jetty.util.component.Dumpable;
43 import org.eclipse.jetty.util.component.LifeCycle;
44 import org.eclipse.jetty.util.ssl.SslContextFactory;
45 import org.eclipse.jetty.util.thread.QueuedThreadPool;
46 import org.eclipse.jetty.util.thread.ThreadPool;
47 import org.eclipse.jetty.util.thread.Timeout;
48 
49 /**
50  * Http Client.
51  * <p/>
52  * HttpClient is the main active component of the client API implementation.
53  * It is the opposite of the Connectors in standard Jetty, in that it listens
54  * for responses rather than requests.   Just like the connectors, there is a
55  * blocking socket version and a non-blocking NIO version (implemented as nested classes
56  * selected by {@link #setConnectorType(int)}).
57  * <p/>
58  * The an instance of {@link HttpExchange} is passed to the {@link #send(HttpExchange)} method
59  * to send a request.  The exchange contains both the headers and content (source) of the request
60  * plus the callbacks to handle responses.   A HttpClient can have many exchanges outstanding
61  * and they may be queued on the {@link HttpDestination} waiting for a {@link AbstractHttpConnection},
62  * queued in the {@link AbstractHttpConnection} waiting to be transmitted or pipelined on the actual
63  * TCP/IP connection waiting for a response.
64  * <p/>
65  * The {@link HttpDestination} class is an aggregation of {@link AbstractHttpConnection}s for the
66  * same host, port and protocol.   A destination may limit the number of connections
67  * open and they provide a pool of open connections that may be reused.   Connections may also
68  * be allocated from a destination, so that multiple request sources are not multiplexed
69  * over the same connection.
70  *
71  * @see HttpExchange
72  * @see HttpDestination
73  */
74 public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attributes, Dumpable
75 {
76     public static final int CONNECTOR_SOCKET = 0;
77     public static final int CONNECTOR_SELECT_CHANNEL = 2;
78 
79     private int _connectorType = CONNECTOR_SELECT_CHANNEL;
80     private boolean _useDirectBuffers = true;
81     private boolean _connectBlocking = true;
82     private int _maxConnectionsPerAddress = Integer.MAX_VALUE;
83     private int _maxQueueSizePerAddress = Integer.MAX_VALUE;
84     private ConcurrentMap<Address, HttpDestination> _destinations = new ConcurrentHashMap<Address, HttpDestination>();
85     ThreadPool _threadPool;
86     Connector _connector;
87     private long _idleTimeout = 20000;
88     private long _timeout = 320000;
89     private int _connectTimeout = 75000;
90     private Timeout _timeoutQ = new Timeout();
91     private Timeout _idleTimeoutQ = new Timeout();
92     private Address _proxy;
93     private Authentication _proxyAuthentication;
94     private Set<String> _noProxy;
95     private int _maxRetries = 3;
96     private int _maxRedirects = 20;
97     private LinkedList<String> _registeredListeners;
98 
99     private final SslContextFactory _sslContextFactory;
100 
101     private RealmResolver _realmResolver;
102 
103     private AttributesMap _attributes=new AttributesMap();
104 
105     private final HttpBuffersImpl _buffers= new HttpBuffersImpl();
106 
107     /* ------------------------------------------------------------------------------- */
setBufferTypes()108     private void setBufferTypes()
109     {
110         if (_connectorType==CONNECTOR_SOCKET)
111         {
112             _buffers.setRequestBufferType(Type.BYTE_ARRAY);
113             _buffers.setRequestHeaderType(Type.BYTE_ARRAY);
114             _buffers.setResponseBufferType(Type.BYTE_ARRAY);
115             _buffers.setResponseHeaderType(Type.BYTE_ARRAY);
116         }
117         else
118         {
119             _buffers.setRequestBufferType(Type.DIRECT);
120             _buffers.setRequestHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT);
121             _buffers.setResponseBufferType(Type.DIRECT);
122             _buffers.setResponseHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT);
123         }
124 
125     }
126 
127     /* ------------------------------------------------------------------------------- */
HttpClient()128     public HttpClient()
129     {
130         this(new SslContextFactory());
131     }
132 
133     /* ------------------------------------------------------------------------------- */
HttpClient(SslContextFactory sslContextFactory)134     public HttpClient(SslContextFactory sslContextFactory)
135     {
136         _sslContextFactory = sslContextFactory;
137         addBean(_sslContextFactory);
138         addBean(_buffers);
139     }
140 
141     /* ------------------------------------------------------------------------------- */
142     /**
143      * @return True if connects will be in blocking mode.
144      */
isConnectBlocking()145     public boolean isConnectBlocking()
146     {
147         return _connectBlocking;
148     }
149 
150     /* ------------------------------------------------------------------------------- */
151     /**
152      * @param connectBlocking True if connects will be in blocking mode.
153      */
setConnectBlocking(boolean connectBlocking)154     public void setConnectBlocking(boolean connectBlocking)
155     {
156         _connectBlocking = connectBlocking;
157     }
158 
159     /* ------------------------------------------------------------------------------- */
send(HttpExchange exchange)160     public void send(HttpExchange exchange) throws IOException
161     {
162         boolean ssl = HttpSchemes.HTTPS_BUFFER.equalsIgnoreCase(exchange.getScheme());
163         HttpDestination destination = getDestination(exchange.getAddress(), ssl);
164         destination.send(exchange);
165     }
166 
167     /* ------------------------------------------------------------ */
168     /**
169      * @return the threadpool
170      */
getThreadPool()171     public ThreadPool getThreadPool()
172     {
173         return _threadPool;
174     }
175 
176     /* ------------------------------------------------------------ */
177     /** Set the ThreadPool.
178      * The threadpool passed is added via {@link #addBean(Object)} so that
179      * it's lifecycle may be managed as a {@link AggregateLifeCycle}.
180      * @param threadPool the threadPool to set
181      */
setThreadPool(ThreadPool threadPool)182     public void setThreadPool(ThreadPool threadPool)
183     {
184         removeBean(_threadPool);
185         _threadPool = threadPool;
186         addBean(_threadPool);
187     }
188 
189 
190     /* ------------------------------------------------------------ */
191     /**
192      * @param name
193      * @return Attribute associated with client
194      */
getAttribute(String name)195     public Object getAttribute(String name)
196     {
197         return _attributes.getAttribute(name);
198     }
199 
200     /* ------------------------------------------------------------ */
201     /**
202      * @return names of attributes associated with client
203      */
getAttributeNames()204     public Enumeration getAttributeNames()
205     {
206         return _attributes.getAttributeNames();
207     }
208 
209     /* ------------------------------------------------------------ */
210     /**
211      * @param name
212      */
removeAttribute(String name)213     public void removeAttribute(String name)
214     {
215         _attributes.removeAttribute(name);
216     }
217 
218     /* ------------------------------------------------------------ */
219     /**
220      * Set an attribute on the HttpClient.
221      * Attributes are not used by the client, but are provided for
222      * so that users of a shared HttpClient may share other structures.
223      * @param name
224      * @param attribute
225      */
setAttribute(String name, Object attribute)226     public void setAttribute(String name, Object attribute)
227     {
228         _attributes.setAttribute(name,attribute);
229     }
230 
231     /* ------------------------------------------------------------ */
clearAttributes()232     public void clearAttributes()
233     {
234         _attributes.clearAttributes();
235     }
236 
237     /* ------------------------------------------------------------------------------- */
getDestination(Address remote, boolean ssl)238     public HttpDestination getDestination(Address remote, boolean ssl) throws IOException
239     {
240         return getDestination(remote, ssl, getSslContextFactory());
241     }
242 
243     /* ------------------------------------------------------------------------------- */
getDestination(Address remote, boolean ssl, SslContextFactory sslContextFactory)244     public HttpDestination getDestination(Address remote, boolean ssl, SslContextFactory sslContextFactory) throws IOException
245     {
246         if (remote == null)
247             throw new UnknownHostException("Remote socket address cannot be null.");
248 
249         HttpDestination destination = _destinations.get(remote);
250         if (destination == null)
251         {
252             destination = new HttpDestination(this, remote, ssl, sslContextFactory);
253             if (_proxy != null && (_noProxy == null || !_noProxy.contains(remote.getHost())))
254             {
255                 destination.setProxy(_proxy);
256                 if (_proxyAuthentication != null)
257                     destination.setProxyAuthentication(_proxyAuthentication);
258             }
259             HttpDestination other =_destinations.putIfAbsent(remote, destination);
260             if (other!=null)
261                 destination=other;
262         }
263         return destination;
264     }
265 
266     /* ------------------------------------------------------------ */
schedule(Timeout.Task task)267     public void schedule(Timeout.Task task)
268     {
269         _timeoutQ.schedule(task);
270     }
271 
272     /* ------------------------------------------------------------ */
schedule(Timeout.Task task, long timeout)273     public void schedule(Timeout.Task task, long timeout)
274     {
275         _timeoutQ.schedule(task, timeout - _timeoutQ.getDuration());
276     }
277 
278     /* ------------------------------------------------------------ */
scheduleIdle(Timeout.Task task)279     public void scheduleIdle(Timeout.Task task)
280     {
281         _idleTimeoutQ.schedule(task);
282     }
283 
284     /* ------------------------------------------------------------ */
cancel(Timeout.Task task)285     public void cancel(Timeout.Task task)
286     {
287         task.cancel();
288     }
289 
290     /* ------------------------------------------------------------ */
291     /**
292      * Get whether the connector can use direct NIO buffers.
293      */
getUseDirectBuffers()294     public boolean getUseDirectBuffers()
295     {
296         return _useDirectBuffers;
297     }
298 
299     /* ------------------------------------------------------------ */
300     /** Set a RealmResolver for client Authentication.
301      * If a realmResolver is set, then the HttpDestinations created by
302      * this client will instantiate a {@link SecurityListener} so that
303      * BASIC and DIGEST authentication can be performed.
304      * @param resolver
305      */
setRealmResolver(RealmResolver resolver)306     public void setRealmResolver(RealmResolver resolver)
307     {
308         _realmResolver = resolver;
309     }
310 
311     /* ------------------------------------------------------------ */
312     /**
313      * returns the SecurityRealmResolver reg_realmResolveristered with the HttpClient or null
314      *
315      * @return the SecurityRealmResolver reg_realmResolveristered with the HttpClient or null
316      */
getRealmResolver()317     public RealmResolver getRealmResolver()
318     {
319         return _realmResolver;
320     }
321 
322     /* ------------------------------------------------------------ */
hasRealms()323     public boolean hasRealms()
324     {
325         return _realmResolver == null ? false : true;
326     }
327 
328 
329     /* ------------------------------------------------------------ */
330     /**
331      * Registers a listener that can listen to the stream of execution between the client and the
332      * server and influence events.  Sequential calls to the method wrapper sequentially wrap the preceding
333      * listener in a delegation model.
334      * <p/>
335      * NOTE: the SecurityListener is a special listener which doesn't need to be added via this
336      * mechanic, if you register security realms then it will automatically be added as the top listener of the
337      * delegation stack.
338      *
339      * @param listenerClass
340      */
registerListener(String listenerClass)341     public void registerListener(String listenerClass)
342     {
343         if (_registeredListeners == null)
344         {
345             _registeredListeners = new LinkedList<String>();
346         }
347         _registeredListeners.add(listenerClass);
348     }
349 
350     /* ------------------------------------------------------------ */
getRegisteredListeners()351     public LinkedList<String> getRegisteredListeners()
352     {
353         return _registeredListeners;
354     }
355 
356 
357     /* ------------------------------------------------------------ */
358     /**
359      * Set to use NIO direct buffers.
360      *
361      * @param direct If True (the default), the connector can use NIO direct
362      *               buffers. Some JVMs have memory management issues (bugs) with
363      *               direct buffers.
364      */
setUseDirectBuffers(boolean direct)365     public void setUseDirectBuffers(boolean direct)
366     {
367         _useDirectBuffers = direct;
368         setBufferTypes();
369     }
370 
371     /* ------------------------------------------------------------ */
372     /**
373      * Get the type of connector (socket, blocking or select) in use.
374      */
getConnectorType()375     public int getConnectorType()
376     {
377         return _connectorType;
378     }
379 
380     /* ------------------------------------------------------------ */
setConnectorType(int connectorType)381     public void setConnectorType(int connectorType)
382     {
383         this._connectorType = connectorType;
384         setBufferTypes();
385     }
386 
387     /* ------------------------------------------------------------ */
getMaxConnectionsPerAddress()388     public int getMaxConnectionsPerAddress()
389     {
390         return _maxConnectionsPerAddress;
391     }
392 
393     /* ------------------------------------------------------------ */
setMaxConnectionsPerAddress(int maxConnectionsPerAddress)394     public void setMaxConnectionsPerAddress(int maxConnectionsPerAddress)
395     {
396         _maxConnectionsPerAddress = maxConnectionsPerAddress;
397     }
398 
getMaxQueueSizePerAddress()399     public int getMaxQueueSizePerAddress()
400     {
401         return _maxQueueSizePerAddress;
402     }
403 
setMaxQueueSizePerAddress(int maxQueueSizePerAddress)404     public void setMaxQueueSizePerAddress(int maxQueueSizePerAddress)
405     {
406         this._maxQueueSizePerAddress = maxQueueSizePerAddress;
407     }
408 
409     /* ------------------------------------------------------------ */
410     @Override
doStart()411     protected void doStart() throws Exception
412     {
413         setBufferTypes();
414 
415         _timeoutQ.setDuration(_timeout);
416         _timeoutQ.setNow();
417         _idleTimeoutQ.setDuration(_idleTimeout);
418         _idleTimeoutQ.setNow();
419 
420         if (_threadPool==null)
421         {
422             QueuedThreadPool pool = new LocalQueuedThreadPool();
423             pool.setMaxThreads(16);
424             pool.setDaemon(true);
425             pool.setName("HttpClient");
426             _threadPool = pool;
427             addBean(_threadPool,true);
428         }
429 
430         _connector=(_connectorType == CONNECTOR_SELECT_CHANNEL)?new SelectConnector(this):new SocketConnector(this);
431         addBean(_connector,true);
432 
433         super.doStart();
434 
435         _threadPool.dispatch(new Runnable()
436         {
437             public void run()
438             {
439                 while (isRunning())
440                 {
441                     _timeoutQ.tick(System.currentTimeMillis());
442                     _idleTimeoutQ.tick(_timeoutQ.getNow());
443                     try
444                     {
445                         Thread.sleep(200);
446                     }
447                     catch (InterruptedException ignored)
448                     {
449                     }
450                 }
451             }
452         });
453     }
454 
455     /* ------------------------------------------------------------ */
456     @Override
doStop()457     protected void doStop() throws Exception
458     {
459         for (HttpDestination destination : _destinations.values())
460             destination.close();
461 
462         _timeoutQ.cancelAll();
463         _idleTimeoutQ.cancelAll();
464 
465         super.doStop();
466 
467         if (_threadPool instanceof LocalQueuedThreadPool)
468         {
469             removeBean(_threadPool);
470             _threadPool = null;
471         }
472 
473         removeBean(_connector);
474     }
475 
476     /* ------------------------------------------------------------ */
477     interface Connector extends LifeCycle
478     {
startConnection(HttpDestination destination)479         public void startConnection(HttpDestination destination) throws IOException;
480     }
481 
482     /* ------------------------------------------------------------ */
483     /**
484      * if a keystore location has been provided then client will attempt to use it as the keystore,
485      * otherwise we simply ignore certificates and run with a loose ssl context.
486      *
487      * @return the SSL context
488      */
getSSLContext()489     protected SSLContext getSSLContext()
490     {
491         return _sslContextFactory.getSslContext();
492     }
493 
494     /* ------------------------------------------------------------ */
495     /**
496      * @return the instance of SslContextFactory associated with the client
497      */
getSslContextFactory()498     public SslContextFactory getSslContextFactory()
499     {
500         return _sslContextFactory;
501     }
502 
503     /* ------------------------------------------------------------ */
504     /**
505      * @return the period in milliseconds a {@link AbstractHttpConnection} can be idle for before it is closed.
506      */
getIdleTimeout()507     public long getIdleTimeout()
508     {
509         return _idleTimeout;
510     }
511 
512     /* ------------------------------------------------------------ */
513     /**
514      * @param ms the period in milliseconds a {@link AbstractHttpConnection} can be idle for before it is closed.
515      */
setIdleTimeout(long ms)516     public void setIdleTimeout(long ms)
517     {
518         _idleTimeout = ms;
519     }
520 
521     /* ------------------------------------------------------------ */
522     /**
523      * @return the period in ms that an exchange will wait for a response from the server.
524      * @deprecated use {@link #getTimeout()} instead.
525      */
526     @Deprecated
getSoTimeout()527     public int getSoTimeout()
528     {
529         return Long.valueOf(getTimeout()).intValue();
530     }
531 
532     /* ------------------------------------------------------------ */
533     /**
534      * @deprecated use {@link #setTimeout(long)} instead.
535      * @param timeout the period in ms that an exchange will wait for a response from the server.
536      */
537     @Deprecated
setSoTimeout(int timeout)538     public void setSoTimeout(int timeout)
539     {
540         setTimeout(timeout);
541     }
542 
543     /* ------------------------------------------------------------ */
544     /**
545      * @return the period in ms that an exchange will wait for a response from the server.
546      */
getTimeout()547     public long getTimeout()
548     {
549         return _timeout;
550     }
551 
552     /* ------------------------------------------------------------ */
553     /**
554      * @param timeout the period in ms that an exchange will wait for a response from the server.
555      */
setTimeout(long timeout)556     public void setTimeout(long timeout)
557     {
558         _timeout = timeout;
559     }
560 
561     /* ------------------------------------------------------------ */
562     /**
563      * @return the period in ms before timing out an attempt to connect
564      */
getConnectTimeout()565     public int getConnectTimeout()
566     {
567         return _connectTimeout;
568     }
569 
570     /* ------------------------------------------------------------ */
571     /**
572      * @param connectTimeout the period in ms before timing out an attempt to connect
573      */
setConnectTimeout(int connectTimeout)574     public void setConnectTimeout(int connectTimeout)
575     {
576         this._connectTimeout = connectTimeout;
577     }
578 
579     /* ------------------------------------------------------------ */
getProxy()580     public Address getProxy()
581     {
582         return _proxy;
583     }
584 
585     /* ------------------------------------------------------------ */
setProxy(Address proxy)586     public void setProxy(Address proxy)
587     {
588         this._proxy = proxy;
589     }
590 
591     /* ------------------------------------------------------------ */
getProxyAuthentication()592     public Authentication getProxyAuthentication()
593     {
594         return _proxyAuthentication;
595     }
596 
597     /* ------------------------------------------------------------ */
setProxyAuthentication(Authentication authentication)598     public void setProxyAuthentication(Authentication authentication)
599     {
600         _proxyAuthentication = authentication;
601     }
602 
603     /* ------------------------------------------------------------ */
isProxied()604     public boolean isProxied()
605     {
606         return this._proxy != null;
607     }
608 
609     /* ------------------------------------------------------------ */
getNoProxy()610     public Set<String> getNoProxy()
611     {
612         return _noProxy;
613     }
614 
615     /* ------------------------------------------------------------ */
setNoProxy(Set<String> noProxyAddresses)616     public void setNoProxy(Set<String> noProxyAddresses)
617     {
618         _noProxy = noProxyAddresses;
619     }
620 
621     /* ------------------------------------------------------------ */
maxRetries()622     public int maxRetries()
623     {
624         return _maxRetries;
625     }
626 
627     /* ------------------------------------------------------------ */
setMaxRetries(int retries)628     public void setMaxRetries(int retries)
629     {
630         _maxRetries = retries;
631     }
632 
633     /* ------------------------------------------------------------ */
maxRedirects()634     public int maxRedirects()
635     {
636         return _maxRedirects;
637     }
638 
639     /* ------------------------------------------------------------ */
setMaxRedirects(int redirects)640     public void setMaxRedirects(int redirects)
641     {
642         _maxRedirects = redirects;
643     }
644 
getRequestBufferSize()645     public int getRequestBufferSize()
646     {
647         return _buffers.getRequestBufferSize();
648     }
649 
setRequestBufferSize(int requestBufferSize)650     public void setRequestBufferSize(int requestBufferSize)
651     {
652         _buffers.setRequestBufferSize(requestBufferSize);
653     }
654 
getRequestHeaderSize()655     public int getRequestHeaderSize()
656     {
657         return _buffers.getRequestHeaderSize();
658     }
659 
setRequestHeaderSize(int requestHeaderSize)660     public void setRequestHeaderSize(int requestHeaderSize)
661     {
662         _buffers.setRequestHeaderSize(requestHeaderSize);
663     }
664 
getResponseBufferSize()665     public int getResponseBufferSize()
666     {
667         return _buffers.getResponseBufferSize();
668     }
669 
setResponseBufferSize(int responseBufferSize)670     public void setResponseBufferSize(int responseBufferSize)
671     {
672         _buffers.setResponseBufferSize(responseBufferSize);
673     }
674 
getResponseHeaderSize()675     public int getResponseHeaderSize()
676     {
677         return _buffers.getResponseHeaderSize();
678     }
679 
setResponseHeaderSize(int responseHeaderSize)680     public void setResponseHeaderSize(int responseHeaderSize)
681     {
682         _buffers.setResponseHeaderSize(responseHeaderSize);
683     }
684 
getRequestBufferType()685     public Type getRequestBufferType()
686     {
687         return _buffers.getRequestBufferType();
688     }
689 
getRequestHeaderType()690     public Type getRequestHeaderType()
691     {
692         return _buffers.getRequestHeaderType();
693     }
694 
getResponseBufferType()695     public Type getResponseBufferType()
696     {
697         return _buffers.getResponseBufferType();
698     }
699 
getResponseHeaderType()700     public Type getResponseHeaderType()
701     {
702         return _buffers.getResponseHeaderType();
703     }
704 
setRequestBuffers(Buffers requestBuffers)705     public void setRequestBuffers(Buffers requestBuffers)
706     {
707         _buffers.setRequestBuffers(requestBuffers);
708     }
709 
setResponseBuffers(Buffers responseBuffers)710     public void setResponseBuffers(Buffers responseBuffers)
711     {
712         _buffers.setResponseBuffers(responseBuffers);
713     }
714 
getRequestBuffers()715     public Buffers getRequestBuffers()
716     {
717         return _buffers.getRequestBuffers();
718     }
719 
getResponseBuffers()720     public Buffers getResponseBuffers()
721     {
722         return _buffers.getResponseBuffers();
723     }
724 
setMaxBuffers(int maxBuffers)725     public void setMaxBuffers(int maxBuffers)
726     {
727         _buffers.setMaxBuffers(maxBuffers);
728     }
729 
getMaxBuffers()730     public int getMaxBuffers()
731     {
732         return _buffers.getMaxBuffers();
733     }
734 
735     /* ------------------------------------------------------------ */
736     @Deprecated
getTrustStoreLocation()737     public String getTrustStoreLocation()
738     {
739         return _sslContextFactory.getTrustStore();
740     }
741 
742     /* ------------------------------------------------------------ */
743     @Deprecated
setTrustStoreLocation(String trustStoreLocation)744     public void setTrustStoreLocation(String trustStoreLocation)
745     {
746         _sslContextFactory.setTrustStore(trustStoreLocation);
747     }
748 
749     /* ------------------------------------------------------------ */
750     @Deprecated
getTrustStoreInputStream()751     public InputStream getTrustStoreInputStream()
752     {
753         return _sslContextFactory.getTrustStoreInputStream();
754     }
755 
756     /* ------------------------------------------------------------ */
757     @Deprecated
setTrustStoreInputStream(InputStream trustStoreInputStream)758     public void setTrustStoreInputStream(InputStream trustStoreInputStream)
759     {
760         _sslContextFactory.setTrustStoreInputStream(trustStoreInputStream);
761     }
762 
763     /* ------------------------------------------------------------ */
764     @Deprecated
getKeyStoreLocation()765     public String getKeyStoreLocation()
766     {
767         return _sslContextFactory.getKeyStorePath();
768     }
769 
770     /* ------------------------------------------------------------ */
771     @Deprecated
setKeyStoreLocation(String keyStoreLocation)772     public void setKeyStoreLocation(String keyStoreLocation)
773     {
774         _sslContextFactory.setKeyStorePath(keyStoreLocation);
775     }
776 
777     @Deprecated
getKeyStoreInputStream()778     public InputStream getKeyStoreInputStream()
779     {
780         return _sslContextFactory.getKeyStoreInputStream();
781     }
782 
783     @Deprecated
setKeyStoreInputStream(InputStream keyStoreInputStream)784     public void setKeyStoreInputStream(InputStream keyStoreInputStream)
785     {
786         _sslContextFactory.setKeyStoreInputStream(keyStoreInputStream);
787     }
788 
789     /* ------------------------------------------------------------ */
790     @Deprecated
setKeyStorePassword(String keyStorePassword)791     public void setKeyStorePassword(String keyStorePassword)
792     {
793         _sslContextFactory.setKeyStorePassword(keyStorePassword);
794     }
795 
796     /* ------------------------------------------------------------ */
797     @Deprecated
setKeyManagerPassword(String keyManagerPassword)798     public void setKeyManagerPassword(String keyManagerPassword)
799     {
800         _sslContextFactory.setKeyManagerPassword(keyManagerPassword);
801     }
802 
803     /* ------------------------------------------------------------ */
804     @Deprecated
setTrustStorePassword(String trustStorePassword)805     public void setTrustStorePassword(String trustStorePassword)
806     {
807         _sslContextFactory.setTrustStorePassword(trustStorePassword);
808     }
809 
810     /* ------------------------------------------------------------ */
811     @Deprecated
getKeyStoreType()812     public String getKeyStoreType()
813     {
814         return _sslContextFactory.getKeyStoreType();
815     }
816 
817     /* ------------------------------------------------------------ */
818     @Deprecated
setKeyStoreType(String keyStoreType)819     public void setKeyStoreType(String keyStoreType)
820     {
821         _sslContextFactory.setKeyStoreType(keyStoreType);
822     }
823 
824     /* ------------------------------------------------------------ */
825     @Deprecated
getTrustStoreType()826     public String getTrustStoreType()
827     {
828         return _sslContextFactory.getTrustStoreType();
829     }
830 
831     /* ------------------------------------------------------------ */
832     @Deprecated
setTrustStoreType(String trustStoreType)833     public void setTrustStoreType(String trustStoreType)
834     {
835         _sslContextFactory.setTrustStoreType(trustStoreType);
836     }
837 
838     /* ------------------------------------------------------------ */
839     @Deprecated
getKeyManagerAlgorithm()840     public String getKeyManagerAlgorithm()
841     {
842         return _sslContextFactory.getSslKeyManagerFactoryAlgorithm();
843     }
844 
845     /* ------------------------------------------------------------ */
846     @Deprecated
setKeyManagerAlgorithm(String keyManagerAlgorithm)847     public void setKeyManagerAlgorithm(String keyManagerAlgorithm)
848     {
849         _sslContextFactory.setSslKeyManagerFactoryAlgorithm(keyManagerAlgorithm);
850     }
851 
852     /* ------------------------------------------------------------ */
853     @Deprecated
getTrustManagerAlgorithm()854     public String getTrustManagerAlgorithm()
855     {
856         return _sslContextFactory.getTrustManagerFactoryAlgorithm();
857     }
858 
859     /* ------------------------------------------------------------ */
860     @Deprecated
setTrustManagerAlgorithm(String trustManagerAlgorithm)861     public void setTrustManagerAlgorithm(String trustManagerAlgorithm)
862     {
863         _sslContextFactory.setTrustManagerFactoryAlgorithm(trustManagerAlgorithm);
864     }
865 
866     /* ------------------------------------------------------------ */
867     @Deprecated
getProtocol()868     public String getProtocol()
869     {
870         return _sslContextFactory.getProtocol();
871     }
872 
873     /* ------------------------------------------------------------ */
874     @Deprecated
setProtocol(String protocol)875     public void setProtocol(String protocol)
876     {
877         _sslContextFactory.setProtocol(protocol);
878     }
879 
880     /* ------------------------------------------------------------ */
881     @Deprecated
getProvider()882     public String getProvider()
883     {
884         return _sslContextFactory.getProvider();
885     }
886 
887     /* ------------------------------------------------------------ */
888     @Deprecated
setProvider(String provider)889     public void setProvider(String provider)
890     {
891         _sslContextFactory.setProvider(provider);
892     }
893 
894     /* ------------------------------------------------------------ */
895     @Deprecated
getSecureRandomAlgorithm()896     public String getSecureRandomAlgorithm()
897     {
898         return _sslContextFactory.getSecureRandomAlgorithm();
899     }
900 
901     /* ------------------------------------------------------------ */
902     @Deprecated
setSecureRandomAlgorithm(String secureRandomAlgorithm)903     public void setSecureRandomAlgorithm(String secureRandomAlgorithm)
904     {
905         _sslContextFactory.setSecureRandomAlgorithm(secureRandomAlgorithm);
906     }
907 
908     private static class LocalQueuedThreadPool extends QueuedThreadPool
909     {
910     }
911 }
912