Skip to content

Commit 130b89a

Browse files
committed
🔖 release 2.0.12.BETA
1 parent 39c6200 commit 130b89a

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ Run with `Maven`:
6464
<dependency>
6565
<groupId>com.bladejava</groupId>
6666
<artifactId>blade-mvc</artifactId>
67-
<version>2.0.12.ALPHA</version>
67+
<version>2.0.12.BETA</version>
6868
</dependency>
6969
```
7070

7171
or `Gradle`:
7272

7373
```sh
74-
compile 'com.bladejava:blade-mvc:2.0.12.ALPHA'
74+
compile 'com.bladejava:blade-mvc:2.0.12.BETA'
7575
```
7676

7777
Write the `main` method and the `Hello World`:

README_CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<dependency>
6262
<groupId>com.bladejava</groupId>
6363
<artifactId>blade-mvc</artifactId>
64-
<version>2.0.12.ALPHA</version>
64+
<version>2.0.12.BETA</version>
6565
</dependency>
6666
```
6767

@@ -70,7 +70,7 @@
7070
或者 `Gradle`:
7171

7272
```sh
73-
compile 'com.bladejava:blade-mvc:2.0.12.ALPHA'
73+
compile 'com.bladejava:blade-mvc:2.0.12.BETA'
7474
```
7575

7676
编写 `main` 函数写一个 `Hello World`

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.bladejava</groupId>
77
<artifactId>blade-mvc</artifactId>
8-
<version>2.0.13-SNAPSHOT</version>
8+
<version>2.0.12.BETA</version>
99
<packaging>jar</packaging>
1010

1111
<name>blade</name>

src/main/java/com/blade/mvc/Const.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface Const {
3131
int DEFAULT_SERVER_PORT = 9000;
3232
String DEFAULT_SERVER_ADDRESS = "0.0.0.0";
3333
String LOCAL_IP_ADDRESS = "127.0.0.1";
34-
String VERSION = "2.0.12.ALPHA";
34+
String VERSION = "2.0.12.BETA";
3535
String WEB_JARS = "/webjars/";
3636
String CLASSPATH = BladeKit.getCurrentClassPath();
3737
String CONTENT_TYPE_HTML = "text/html; charset=UTF-8";

src/main/java/com/blade/mvc/http/HttpRequest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import com.blade.server.netty.HttpConst;
2828
import com.blade.server.netty.HttpServerHandler;
2929
import io.netty.buffer.ByteBuf;
30-
import io.netty.buffer.ByteBufAllocator;
31-
import io.netty.buffer.CompositeByteBuf;
3230
import io.netty.buffer.Unpooled;
3331
import io.netty.handler.codec.http.*;
3432
import io.netty.handler.codec.http.cookie.ServerCookieDecoder;
@@ -56,8 +54,8 @@
5654
@NoArgsConstructor
5755
public class HttpRequest implements Request {
5856

59-
private static final HttpDataFactory factory =
60-
new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE); // Disk if size exceed
57+
private static final HttpDataFactory HTTP_DATA_FACTORY =
58+
new DefaultHttpDataFactory(true); // Disk if size exceed
6159

6260
private static final ByteBuf EMPTY_BUF = Unpooled.copiedBuffer("", CharsetUtil.UTF_8);
6361

@@ -348,22 +346,22 @@ public void init(String remoteAddress) {
348346
}
349347

350348
try {
351-
HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(factory, nettyRequest);
349+
HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(HTTP_DATA_FACTORY, nettyRequest);
352350
this.isMultipart = decoder.isMultipart();
353351

354-
List<ByteBuf> byteBufs = new ArrayList<>(this.contents.size());
352+
List<ByteBuf> byteBuffs = new ArrayList<>(this.contents.size());
355353

356354
for (HttpContent content : this.contents) {
357355
if (!isMultipart) {
358-
byteBufs.add(content.content().copy());
356+
byteBuffs.add(content.content().copy());
359357
}
360358

361359
decoder.offer(content);
362360
this.readHttpDataChunkByChunk(decoder);
363361
content.release();
364362
}
365-
if (!byteBufs.isEmpty()) {
366-
this.body = Unpooled.copiedBuffer(byteBufs.stream().toArray(ByteBuf[]::new));
363+
if (!byteBuffs.isEmpty()) {
364+
this.body = Unpooled.copiedBuffer(byteBuffs.toArray(new ByteBuf[0]));
367365
}
368366
} catch (Exception e) {
369367
throw new HttpParseException("build decoder fail", e);

0 commit comments

Comments
 (0)