Skip to content

Commit 1ae35d4

Browse files
author
yanzhenjie
committed
Last stable version of 1.0.5, recommended to use.
1 parent b732749 commit 1ae35d4

File tree

80 files changed

+1039
-1068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1039
-1068
lines changed

HttpServer/WebContent/index.html

Lines changed: 52 additions & 52 deletions
Large diffs are not rendered by default.

Jar/nohttp1.0.5-include-source.jar

236 KB
Binary file not shown.

Jar/nohttp1.0.5.jar

104 KB
Binary file not shown.

README-cn.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ NoHttp源码:[https://github.com/yanzhenjie/NoHttp][1]
2727
2828
* AndroidStudio使用Gradle构建添加依赖(推荐)
2929
```groovy
30-
compile 'com.yolanda.nohttp:nohttp:1.0.4'
30+
compile 'com.yolanda.nohttp:nohttp:1.0.5'
3131
```
3232

3333
#下载Demo
@@ -173,7 +173,7 @@ request.add("file1", new FileBinary(File));
173173
request.add("file2", new FileBinary(File));
174174
request.add("file3", new InputStreamBinary(InputStream));
175175
request.add("file4", new ByteArrayBinary(byte[]));
176-
request.add("file5", new BitmapStreamBinary(Bitmap));
176+
request.add("file5", new BitmapBinary(Bitmap));
177177
```
178178

179179
##上传多个文件、一个Key多个文件形式
@@ -183,7 +183,7 @@ Request<String> request = ...
183183
fileList.add("image", new FileBinary(File));
184184
fileList.add("image", new InputStreamBinary(InputStream));
185185
fileList.add("image", new ByteArrayBinary(byte[]));
186-
fileList.add("image", new BitmapStreamBinary(Bitmap));
186+
fileList.add("image", new BitmapBinary(Bitmap));
187187
```
188188
  或者:
189189
```java
@@ -322,11 +322,12 @@ queue.stop();
322322
public class FastJsonRequest extends RestRequestor<JSONObject> {
323323

324324
public FastJsonRequest(String url) {
325-
super(url);
325+
this(url, RequestMethod.GET);
326326
}
327327

328328
public FastJsonRequest(String url, RequestMethod requestMethod) {
329329
super(url, requestMethod);
330+
setAccept("application/json");
330331
}
331332

332333
@Override
@@ -341,12 +342,6 @@ public class FastJsonRequest extends RestRequestor<JSONObject> {
341342
}
342343
return jsonObject;
343344
}
344-
345-
@Override
346-
public String getAccept() {
347-
// 告诉服务器你接受什么类型的数据
348-
return "application/json";
349-
}
350345
}
351346
```
352347

@@ -393,9 +388,9 @@ limitations under the License.
393388
[5]: http://www.nohttp.net
394389
[6]: http://doc.nohttp.net
395390
[7]: https://github.com/yanzhenjie/NoHttp/issues
396-
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.4.jar?raw=true
391+
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5.jar?raw=true
397392
[9]: https://github.com/yanzhenjie/NoHttp/blob/master/nohttp_sample.apk?raw=true
398393
[10]: http://www.nohttp.net/image/nohttp_logo.svg
399-
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.4-include-source.jar?raw=true
394+
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5-include-source.jar?raw=true
400395
[12]: http://www.yanzhenjie.com
401-
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.4
396+
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.5

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Document also continues to improve, there is a problem can send [issues][7], or
2222
2323
* AndroidStudio using Gradle build add dependent (recommended)
2424
```groovy
25-
compile 'com.yolanda.nohttp:nohttp:1.0.4'
25+
compile 'com.yolanda.nohttp:nohttp:1.0.5'
2626
```
2727

2828
# Download Demo
@@ -171,7 +171,7 @@ request.add("file1", new FileBinary(File));
171171
request.add("file2", new FileBinary(File));
172172
request.add("file3", new InputStreamBinary(InputStream));
173173
request.add("file4", new ByteArrayBinary(byte[]));
174-
request.add("file5", new BitmapStreamBinary(Bitmap));
174+
request.add("file5", new BitmapBinary(Bitmap));
175175
```
176176

177177
## Upload multiple files, a Key form of multiple files
@@ -181,7 +181,7 @@ Request<String> request = ...
181181
fileList.add("image", new FileBinary(File));
182182
fileList.add("image", new InputStreamBinary(InputStream));
183183
fileList.add("image", new ByteArrayBinary(byte[]));
184-
fileList.add("image", new BitmapStreamBinary(Bitmap));
184+
fileList.add("image", new BitmapBinary(Bitmap));
185185
```
186186
 Or:
187187
```java
@@ -191,7 +191,7 @@ List<Binary> fileList = ...
191191
fileList.add(new FileBinary(File));
192192
fileList.add(new InputStreamBinary(InputStream));
193193
fileList.add(new ByteArrayBinary(byte[]));
194-
fileList.add(new BitmapStreamBinary(Bitmap));
194+
fileList.add(new BitmapBinary(Bitmap));
195195
request.add("file_list", fileList);
196196
```
197197

@@ -320,11 +320,12 @@ queue.stop();
320320
public class FastJsonRequest extends RestRequestor<JSONObject> {
321321

322322
public FastJsonRequest(String url) {
323-
super(url);
323+
this(url, RequestMethod.GET);
324324
}
325325

326326
public FastJsonRequest(String url, RequestMethod requestMethod) {
327327
super(url, requestMethod);
328+
setHeader("application/json");
328329
}
329330

330331
@Override
@@ -338,11 +339,6 @@ public class FastJsonRequest extends RestRequestor<JSONObject> {
338339
}
339340
return jsonObject;
340341
}
341-
342-
@Override
343-
public String getAccept() {
344-
return "application/json";
345-
}
346342
}
347343
```
348344

@@ -389,11 +385,11 @@ limitations under the License.
389385
[5]: http://www.nohttp.net
390386
[6]: http://doc.nohttp.net
391387
[7]: https://github.com/yanzhenjie/NoHttp/issues
392-
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.4.jar?raw=true
388+
[8]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5.jar?raw=true
393389
[9]: https://github.com/yanzhenjie/NoHttp/blob/master/nohttp_sample.apk?raw=true
394390
[10]: http://www.nohttp.net/image/nohttp_logo.svg
395-
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.4-include-source.jar?raw=true
391+
[11]: https://github.com/yanzhenjie/NoHttp/blob/master/Jar/nohttp1.0.5-include-source.jar?raw=true
396392
[12]: http://www.yanzhenjie.com
397-
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.4
393+
[13]: https://codeload.github.com/yanzhenjie/NoHttp/zip/1.0.5
398394
[14]: https://github.com/yanzhenjie/NoHttp/blob/master/README-cn.md
399395
[15]: http://www.ietf.org/rfc/rfc2616.txt

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
21
buildscript {
32
repositories {
43
jcenter()
@@ -12,4 +11,4 @@ allprojects {
1211
repositories {
1312
jcenter()
1413
}
15-
}
14+
}

nohttp/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
apply plugin: 'com.android.library'
2+
23
android {
34
compileSdkVersion 23
45
buildToolsVersion "23.0.3"
5-
resourcePrefix "nohttp_res_"
66

77
defaultConfig {
88
minSdkVersion 9
99
targetSdkVersion 23
10-
versionCode 4
11-
versionName '1.0.4'
1210
}
1311
}

nohttp/src/main/java/com/yolanda/nohttp/BasicBinary.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public void onWriteBinary(OutputStream outputStream) {
119119

120120
@Override
121121
public String getFileName() {
122+
if (TextUtils.isEmpty(fileName))
123+
fileName = Long.toString(System.currentTimeMillis());
122124
return fileName;
123125
}
124126

0 commit comments

Comments
 (0)