Skip to content

Commit

Permalink
Release 1.0.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
yanzhenjie committed Sep 4, 2016
1 parent 78e5b01 commit f56c020
Show file tree
Hide file tree
Showing 21 changed files with 124 additions and 185 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/nohttp/build
/HttpServer/build
.idea/workspace.xml
/.idea/libraries
12 changes: 0 additions & 12 deletions .idea/libraries/animated_vector_drawable_23_4_0.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/libraries/appcompat_v7_23_4_0.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/libraries/cardview_v7_23_4_0.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/libraries/design_23_4_0.xml

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/libraries/fastjson_1_2_11.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/libraries/recyclerview_v7_23_4_0.xml

This file was deleted.

11 changes: 0 additions & 11 deletions .idea/libraries/support_annotations_23_4_0.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/libraries/support_v4_23_4_0.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/libraries/support_vector_drawable_23_4_0.xml

This file was deleted.

Binary file added Jar/nohttp1.0.6-include-source.jar
Binary file not shown.
Binary file added Jar/nohttp1.0.6.jar
Binary file not shown.
16 changes: 7 additions & 9 deletions README-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@

[**English document**][1]

技术交流1群:46523908
技术交流2群:46505645
[群行为规范][2]
技术交流群:547839514
加群请一定阅读[群行为规范][2]

严振杰的主页:[http://www.yanzhenjie.com][12]
严振杰的博客:[http://blog.csdn.net/yanzhenjie1003][3]
严振杰的Android直播视频下载:[http://pan.baidu.com/s/1miEOtwG][4]
严振杰的博客:[http://blog.yanzhenjie.com](http://blog.yanzhenjie.com)

----
#NoHttp主页和文档地址
Expand All @@ -27,7 +25,7 @@ NoHttp源码:[https://github.com/yanzhenjie/NoHttp][1]
* AndroidStudio使用Gradle构建添加依赖(推荐)
```groovy
compile 'com.yolanda.nohttp:nohttp:1.0.5'
compile 'com.yolanda.nohttp:nohttp:1.0.6'
```

#下载Demo
Expand Down Expand Up @@ -388,9 +386,9 @@ limitations under the License.
[5]: http://www.nohttp.net
[6]: http://doc.nohttp.net
[7]: https://github.com/yanzhenjie/NoHttp/issues
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5.jar?raw=true
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.6.jar?raw=true
[9]: https://github.com/yanzhenjie/NoHttp/blob/master/nohttp_sample.apk?raw=true
[10]: http://www.nohttp.net/image/nohttp_logo.svg
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5-include-source.jar?raw=true
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.6-include-source.jar?raw=true
[12]: http://www.yanzhenjie.com
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.5
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.6
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# NoHttp
> NoHttp, feeling spill(NoHttp,情怀四溢).
> NoHttp, feeling spill.
![NoHttp Logo][10]
![NoHttp Logo](http://www.nohttp.net/image/nohttp_logo.svg)

[**中文版文档**][14]

The author's url: [http://www.yanzhenjie.com][12]
The author's blog: [http://blog.csdn.net/yanzhenjie1003][3]
[**中文版文档**](https://github.com/yanzhenjie/NoHttp/blob/master/README-cn.md)

----
# NoHttp home page and doc url
NoHttp home page: [http://www.nohttp.net][5]
NoHttp document: [http://doc.nohttp.net][6]
NoHttp source code: [https://github.com/yanzhenjie/NoHttp][1]
Document also continues to improve, there is a problem can send [issues][7], or send an email to me directly: [email protected].
NoHttp source code: [https://github.com/yanzhenjie/NoHttp](https://github.com/yanzhenjie/NoHttp/)
Document also continues to improve, there is a problem can send [issues](https://github.com/yanzhenjie/NoHttp/issues), or send an email to me directly: [email protected].

# How to use
* Eclipse use [NoHttp Jar][8], if need to rely on the source code, [download][13].
Expand All @@ -22,7 +17,7 @@ Document also continues to improve, there is a problem can send [issues][7], or
* AndroidStudio using Gradle build add dependent (recommended)
```groovy
compile 'com.yolanda.nohttp:nohttp:1.0.5'
compile 'com.yolanda.nohttp:nohttp:1.0.6'
```

# Download Demo
Expand Down Expand Up @@ -378,18 +373,14 @@ See the License for the specific language governing permissions and
limitations under the License.
```

[1]: https://github.com/yanzhenjie/NoHttp/
[2]: https://github.com/yanzhenjie/SkillGroupRule
[3]: http://blog.csdn.net/yanzhenjie1003
[4]: http://pan.baidu.com/s/1miEOtwG
[5]: http://www.nohttp.net
[6]: http://doc.nohttp.net
[7]: https://github.com/yanzhenjie/NoHttp/issues
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5.jar?raw=true
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.6.jar?raw=true
[9]: https://github.com/yanzhenjie/NoHttp/blob/master/nohttp_sample.apk?raw=true
[10]: http://www.nohttp.net/image/nohttp_logo.svg
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5-include-source.jar?raw=true
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.6-include-source.jar?raw=true
[12]: http://www.yanzhenjie.com
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.5
[14]: https://github.com/yanzhenjie/NoHttp/blob/master/README-cn.md
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.6
[15]: http://www.ietf.org/rfc/rfc2616.txt
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ allprojects {
repositories {
jcenter()
}
}
}
23 changes: 6 additions & 17 deletions nohttp/src/main/java/com/yolanda/nohttp/BasicConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class BasicConnection {
* @param request {@link IBasicRequest}.
* @return {@link ProtocolResult}.
*/
protected Connection getConnection(IBasicRequest request) {
public Connection getConnection(IBasicRequest request) {
Logger.d("--------------Request start--------------");

Headers responseHeaders = new HttpHeaders();
Expand Down Expand Up @@ -306,7 +306,7 @@ private Connection handleRedirect(IBasicRequest oldRequest, Headers responseHead
* @return when the normal return the correct input stream, returns the error when the response code is more than 400 input stream.
* @throws IOException if no InputStream could be created.
*/
protected InputStream getServerStream(int responseCode, String contentEncoding, HttpURLConnection urlConnection) throws IOException {
private InputStream getServerStream(int responseCode, String contentEncoding, HttpURLConnection urlConnection) throws IOException {
if (responseCode >= 400)
return getErrorStream(contentEncoding, urlConnection);
else {
Expand All @@ -322,7 +322,7 @@ protected InputStream getServerStream(int responseCode, String contentEncoding,
* @return http input stream.
* @throws IOException Unpack the stream may be thrown, or if no input stream could be created.
*/
protected InputStream getInputStream(String contentEncoding, HttpURLConnection urlConnection) throws IOException {
private InputStream getInputStream(String contentEncoding, HttpURLConnection urlConnection) throws IOException {
InputStream inputStream = urlConnection.getInputStream();
return gzipInputStream(contentEncoding, inputStream);
}
Expand All @@ -335,7 +335,7 @@ protected InputStream getInputStream(String contentEncoding, HttpURLConnection u
* @return http error stream.
* @throws IOException Unpack the stream may be thrown.
*/
protected InputStream getErrorStream(String contentEncoding, HttpURLConnection urlConnection) throws IOException {
private InputStream getErrorStream(String contentEncoding, HttpURLConnection urlConnection) throws IOException {
InputStream inputStream = urlConnection.getErrorStream();
return gzipInputStream(contentEncoding, inputStream);
}
Expand All @@ -348,7 +348,7 @@ protected InputStream getErrorStream(String contentEncoding, HttpURLConnection u
* @return It can directly read normal data flow
* @throws IOException if an {@code IOException} occurs.
*/
protected InputStream gzipInputStream(String contentEncoding, InputStream inputStream) throws IOException {
private InputStream gzipInputStream(String contentEncoding, InputStream inputStream) throws IOException {
if (HeaderUtil.isGzipContent(contentEncoding)) {
inputStream = new GZIPInputStream(inputStream);
}
Expand All @@ -364,7 +364,7 @@ protected InputStream gzipInputStream(String contentEncoding, InputStream inputS
* @param responseHeaders responseHeaders of server.
* @return response headers of server.
*/
protected Headers parseResponseHeaders(URI uri, int responseCode, String responseMessage, Map<String, List<String>> responseHeaders) {
private Headers parseResponseHeaders(URI uri, int responseCode, String responseMessage, Map<String, List<String>> responseHeaders) {
// handle cookie
if (NoHttp.isEnableCookie())
try {
Expand Down Expand Up @@ -416,17 +416,6 @@ public static boolean hasResponseBody(int responseCode) {
return !(100 <= responseCode && responseCode < 200) && responseCode != 204 && responseCode != 205 && !(300 <= responseCode && responseCode < 400);
}

/**
* This requestMethod and responseCode has responseBody ?
*
* @param requestMethod it's come from {@link RequestMethod}.
* @param responseCode responseCode from server.
* @return true: there is data, false: no data.
*/
public static boolean hasDownload(RequestMethod requestMethod, int responseCode) {
return requestMethod != RequestMethod.HEAD && hasDownload(responseCode);
}

/**
* According to the response code to judge whether there is download data.
*
Expand Down
16 changes: 5 additions & 11 deletions nohttp/src/main/java/com/yolanda/nohttp/NoHttp.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import android.app.Application;
import android.graphics.Bitmap;
import android.os.Build;
import android.widget.ImageView;

import com.yolanda.nohttp.cache.Cache;
Expand All @@ -38,10 +37,10 @@
import com.yolanda.nohttp.rest.Request;
import com.yolanda.nohttp.rest.RequestQueue;
import com.yolanda.nohttp.rest.Response;
import com.yolanda.nohttp.rest.RestConnection;
import com.yolanda.nohttp.rest.RestParser;
import com.yolanda.nohttp.rest.RestProtocol;
import com.yolanda.nohttp.rest.StringRequest;
import com.yolanda.nohttp.tools.AndroidVersion;

import org.json.JSONArray;
import org.json.JSONObject;
Expand Down Expand Up @@ -140,7 +139,7 @@ public static RequestQueue newRequestQueue(int threadPoolSize) {
* @see #newRequestQueue(IRestParser, int)
*/
public static RequestQueue newRequestQueue(Cache<CacheEntity> cache, int threadPoolSize) {
return newRequestQueue(RestProtocol.getInstance(cache), threadPoolSize);
return newRequestQueue(RestProtocol.getInstance(cache, RestConnection.getInstance()), threadPoolSize);
}

/**
Expand Down Expand Up @@ -312,7 +311,7 @@ public static <T> Response<T> startRequestSync(IParserRequest<T> request) {
* @see #startRequestSync(IRestParser, IParserRequest)
*/
public static <T> Response<T> startRequestSync(Cache<CacheEntity> cache, IParserRequest<T> request) {
return startRequestSync(RestProtocol.getInstance(cache), request);
return startRequestSync(RestProtocol.getInstance(cache, RestConnection.getInstance()), request);
}

/**
Expand Down Expand Up @@ -447,7 +446,7 @@ public static DownloadRequest createDownloadRequest(String url, RequestMethod re
* @return {@link String}.
*/
public static String versionName() {
return "1.0.5";
return "1.0.6";
}

/**
Expand All @@ -456,7 +455,7 @@ public static String versionName() {
* @return {@link Integer}.
*/
public static int versionCode() {
return 105;
return 106;
}

/**
Expand All @@ -479,11 +478,6 @@ public static void initialize(Application application) {
if (sApplication == null) {
sApplication = application;
sCookieManager = new CookieManager(DiskCookieStore.INSTANCE, CookiePolicy.ACCEPT_ALL);

if (Build.VERSION.SDK_INT < AndroidVersion.KITKAT) {
System.setProperty("http.keepAlive", "false");
System.setProperty("http.maxConnections", String.valueOf(5));
}
}
}

Expand Down
Loading

0 comments on commit f56c020

Please sign in to comment.