Connection和HttpsURLConnection之间的

Connection和HttpsURLConnection之间的

本文介绍了URLConnection,HttpURLConnection和HttpsURLConnection之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

URLConnection HttpURLConnection HttpsURLConnection (使用SSL)。在什么条件下,我应该使用哪一个?

What is the difference between URLConnection, HttpURLConnection and HttpsURLConnection (with SSL). Under what conditions, which one should I use?

推荐答案

是基类。

是一个派生类,当您需要额外的API并且只处理HTTP或HTTPS时,可以使用它。

HttpURLConnection is a derived class which you can use when you need the extra API and you are dealing with HTTP or HTTPS only.

是一个更多派生的类,您可以在需要更多额外API并且仅处理HTTPS时使用该类。

HttpsURLConnection is a 'more derived' class which you can use when you need the 'more extra' API and you are dealing with HTTPS only.

所有这三个都是抽象的,并且由您不熟悉的特定类实现。

All three of them are abstract, and implemented by specific classes you aren't privy to.

这篇关于URLConnection,HttpURLConnection和HttpsURLConnection之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:35