diff --git a/README.md b/README.md index cf01e0737..af317602f 100644 --- a/README.md +++ b/README.md @@ -64,14 +64,14 @@ Run with `Maven`: com.bladejava blade-mvc - 2.0.12.ALPHA + 2.0.12.BETA ``` or `Gradle`: ```sh -compile 'com.bladejava:blade-mvc:2.0.12.ALPHA' +compile 'com.bladejava:blade-mvc:2.0.12.BETA' ``` Write the `main` method and the `Hello World`: diff --git a/README_CN.md b/README_CN.md index eeacac06d..a4a3997bc 100644 --- a/README_CN.md +++ b/README_CN.md @@ -61,7 +61,7 @@ com.bladejava blade-mvc - 2.0.12.ALPHA + 2.0.12.BETA ``` @@ -70,7 +70,7 @@ 或者 `Gradle`: ```sh -compile 'com.bladejava:blade-mvc:2.0.12.ALPHA' +compile 'com.bladejava:blade-mvc:2.0.12.BETA' ``` 编写 `main` 函数写一个 `Hello World`: diff --git a/pom.xml b/pom.xml index 59a17d96c..d528325f9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bladejava blade-mvc - 2.0.13-SNAPSHOT + 2.0.12.BETA jar blade diff --git a/src/main/java/com/blade/mvc/Const.java b/src/main/java/com/blade/mvc/Const.java index 8f6417de0..27bb935f9 100644 --- a/src/main/java/com/blade/mvc/Const.java +++ b/src/main/java/com/blade/mvc/Const.java @@ -31,7 +31,7 @@ public interface Const { int DEFAULT_SERVER_PORT = 9000; String DEFAULT_SERVER_ADDRESS = "0.0.0.0"; String LOCAL_IP_ADDRESS = "127.0.0.1"; - String VERSION = "2.0.12.ALPHA"; + String VERSION = "2.0.12.BETA"; String WEB_JARS = "/webjars/"; String CLASSPATH = BladeKit.getCurrentClassPath(); String CONTENT_TYPE_HTML = "text/html; charset=UTF-8"; diff --git a/src/main/java/com/blade/mvc/http/HttpRequest.java b/src/main/java/com/blade/mvc/http/HttpRequest.java index 6f4ce8b0d..4a769454d 100644 --- a/src/main/java/com/blade/mvc/http/HttpRequest.java +++ b/src/main/java/com/blade/mvc/http/HttpRequest.java @@ -27,8 +27,6 @@ import com.blade.server.netty.HttpConst; import com.blade.server.netty.HttpServerHandler; import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.CompositeByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.*; import io.netty.handler.codec.http.cookie.ServerCookieDecoder; @@ -56,8 +54,8 @@ @NoArgsConstructor public class HttpRequest implements Request { - private static final HttpDataFactory factory = - new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE); // Disk if size exceed + private static final HttpDataFactory HTTP_DATA_FACTORY = + new DefaultHttpDataFactory(true); // Disk if size exceed private static final ByteBuf EMPTY_BUF = Unpooled.copiedBuffer("", CharsetUtil.UTF_8); @@ -348,22 +346,22 @@ public void init(String remoteAddress) { } try { - HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(factory, nettyRequest); + HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(HTTP_DATA_FACTORY, nettyRequest); this.isMultipart = decoder.isMultipart(); - List byteBufs = new ArrayList<>(this.contents.size()); + List byteBuffs = new ArrayList<>(this.contents.size()); for (HttpContent content : this.contents) { if (!isMultipart) { - byteBufs.add(content.content().copy()); + byteBuffs.add(content.content().copy()); } decoder.offer(content); this.readHttpDataChunkByChunk(decoder); content.release(); } - if (!byteBufs.isEmpty()) { - this.body = Unpooled.copiedBuffer(byteBufs.stream().toArray(ByteBuf[]::new)); + if (!byteBuffs.isEmpty()) { + this.body = Unpooled.copiedBuffer(byteBuffs.toArray(new ByteBuf[0])); } } catch (Exception e) { throw new HttpParseException("build decoder fail", e);