Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code syntax highlighting to Readme #258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

* Android Studio

```
compile 'com.zhy:okhttputils:2.6.2'
```
```groovy
compile 'com.zhy:okhttputils:2.6.2'
```

* Eclipse

Expand Down Expand Up @@ -60,7 +60,7 @@ public class MyApplication extends Application

对于cookie一样,直接通过cookiejar方法配置,参考上面的配置过程。

```
```java
CookieJarImpl cookieJar = new CookieJarImpl(new PersistentCookieStore(getApplicationContext()));
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.cookieJar(cookieJar)
Expand All @@ -85,7 +85,7 @@ OkHttpUtils.initClient(okHttpClient);

初始化OkhttpClient时,通过设置拦截器实现,框架中提供了一个`LoggerInterceptor `,当然你可以自行实现一个Interceptor 。

```
```java
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(new LoggerInterceptor("TAG"))
//其他配置
Expand All @@ -100,7 +100,7 @@ OkHttpUtils.initClient(okHttpClient);

* 设置可访问所有的https网站

```
```java
HttpsUtils.SSLParams sslParams = HttpsUtils.getSslSocketFactory(null, null, null);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager)
Expand All @@ -111,7 +111,7 @@ OkHttpUtils.initClient(okHttpClient);

* 设置具体的证书

```
```java
HttpsUtils.SSLParams sslParams = HttpsUtils.getSslSocketFactory(证书的inputstream, null, null);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.sslSocketFactory(sslParams.sSLSocketFactory, sslParams.trustManager))
Expand All @@ -122,7 +122,7 @@ OkHttpUtils.initClient(okHttpClient);

* 双向认证

```
```java
HttpsUtils.getSslSocketFactory(
证书的inputstream,
本地证书的inputstream,
Expand Down Expand Up @@ -346,7 +346,7 @@ OkHttpUtils

### 同步的请求

```
```java
Response response = OkHttpUtils
.get()//
.url(url)//
Expand Down Expand Up @@ -408,9 +408,3 @@ protected void onDestroy()


```