Skip to content

Commit

Permalink
Undertow version change.
Browse files Browse the repository at this point in the history
  • Loading branch information
noboomu committed Sep 20, 2017
1 parent 16123e0 commit 1e3fc55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.sinistral</groupId>
<artifactId>proteus-core</artifactId>
<version>0.1.6-SNAPSHOT</version>
<version>0.1.7-SNAPSHOT</version>
<name>proteus core</name>
<description>Proteus is an extremely light, fast, and flexible Java REST API framework built atop Undertow.</description>
<url>http://github.com/noboomu/proteus</url>
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/io/sinistral/proteus/server/ServerRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Map;
import java.util.concurrent.Executor;

import org.xnio.Pool;
import org.xnio.Pooled;
import org.xnio.channels.StreamSourceChannel;

Expand Down Expand Up @@ -142,7 +143,8 @@ private void extractBytes() throws IOException
{

this.exchange.startBlocking();



try (Pooled<ByteBuffer> pooled = exchange.getConnection().getBufferPool().allocate()){
ByteBuffer buf = pooled.getResource();

Expand All @@ -159,8 +161,13 @@ private void extractBytes() throws IOException
int pos = buf.limit();

ByteBuffer buffer = ByteBuffer.allocate(pos);

ByteBuffer src = buf.duplicate();
src.position(0);
src.limit(0 + pos);
buffer.put(src);

System.arraycopy(buf.array(), 0, buffer.array(), 0, pos);
//System.arraycopy(buf.array(), 0, buffer.array(), 0, pos);

exchange.putAttachment(BYTE_BUFFER_KEY, buffer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public RoutingHandler get()

final FileResourceManager fileResourceManager = new FileResourceManager(Paths.get(assetsDirectoryName).toFile(),1024l);

router.add(Methods.GET, assetsPath + "/*", io.undertow.Handlers.rewrite("regex('" + assetsPath + "/(.*)')", "/$1", getClass().getClassLoader(), new ResourceHandler(fileResourceManager)
router.add(Methods.GET, assetsPath + "/*", io.undertow.Handlers.rewrite("regex['" + assetsPath + "/(.*)']", "/$1", getClass().getClassLoader(), new ResourceHandler(fileResourceManager)
.setCachable(TruePredicate.instance())
.setCacheTime(assetsCacheTime)
));
Expand Down

0 comments on commit 1e3fc55

Please sign in to comment.