Skip to content

Commit

Permalink
🔖 release 2.0.12.BETA
Browse files Browse the repository at this point in the history
  • Loading branch information
hellokaton committed Nov 26, 2018
1 parent 39c6200 commit 130b89a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ Run with `Maven`:
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-mvc</artifactId>
<version>2.0.12.ALPHA</version>
<version>2.0.12.BETA</version>
</dependency>
```

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`:
Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-mvc</artifactId>
<version>2.0.12.ALPHA</version>
<version>2.0.12.BETA</version>
</dependency>
```

Expand All @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.bladejava</groupId>
<artifactId>blade-mvc</artifactId>
<version>2.0.13-SNAPSHOT</version>
<version>2.0.12.BETA</version>
<packaging>jar</packaging>

<name>blade</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/blade/mvc/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/com/blade/mvc/http/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<ByteBuf> byteBufs = new ArrayList<>(this.contents.size());
List<ByteBuf> 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);
Expand Down

0 comments on commit 130b89a

Please sign in to comment.