什么是apache中的SchemeRegistry以及何时应该使用它? [英] What is SchemeRegistry in apache and When it should be used?

查看:1915
本文介绍了什么是apache中的SchemeRegistry以及何时应该使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apache HTTPClient包含 SchemeRegistry class (org.apache.http.conn.scheme.SchemeRegistry)

Apache HTTPClient contains SchemeRegistry class (org.apache.http.conn.scheme.SchemeRegistry)


  • 什么是Scheme Registry?

  • 什么时候可以使用?

如果我使用下面的方案注册表会产生什么影响

What impact does it make if i use scheme registry like below

SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme(WEBSERVICE_URI_SCHEME, 80 ,PlainSocketFactory.getSocketFactory()));
PoolingClientConnectionManager wsConnManager = new PoolingClientConnectionManager (registry);


推荐答案


什么是Scheme Registry ?

What is Scheme Registry?

协议方案注册表维护每个不同协议方案的连接套接字工厂的映射。例如,HTTPS方案要求使用TLS / SSL保护连接。人们可能还想通过为这些方案注册自定义套接字工厂来自定义创建和初始化HTTP和HTTPS方案的套接字的方式。

Protocol scheme registry maintains a map of connection socket factories per distinct protocol scheme. For instance, HTTPS scheme requires that connections be secured with TLS/SSL. One may also want to customize the way sockets for HTTP and HTTPS schemes are created and initialized by registering a custom socket factory for those schemes.


如果我使用下面的方案注册表会产生什么影响

What impact does it make if i use scheme registry like below

你最终得到了一个自定义协议方案(比如, MYHTTP )。

You end up with a custom protocol scheme (say, MYHTTP).

每当您使用此方案执行请求(例如, myhttp:// somehost / someservice / )时,您的自定义套接字工厂将用于创建和初始化到目标服务器的传出连接。

Whenever you execute a request using this scheme (say, myhttp://somehost/someservice/) your custom socket factory will be used to create and initialize outgoing connections to the target server.

这篇关于什么是apache中的SchemeRegistry以及何时应该使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆