diff --git a/pom.xml b/pom.xml
index 97ff6fb..8687df3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
UTF-8
2.8.8.1
3.0.0
- 1.2.5.Final
+ 1.4.13.Final
diff --git a/src/main/java/io/sinistral/proteus/server/Extractors.java b/src/main/java/io/sinistral/proteus/server/Extractors.java
index 37872a9..5ae6922 100644
--- a/src/main/java/io/sinistral/proteus/server/Extractors.java
+++ b/src/main/java/io/sinistral/proteus/server/Extractors.java
@@ -344,7 +344,7 @@ public static Path filePath(final HttpServerExchange exchange, final String nam
{
try
{
- return exchange.getAttachment(FormDataParser.FORM_DATA).get(name).getFirst().getFile().toPath();
+ return exchange.getAttachment(FormDataParser.FORM_DATA).get(name).getFirst().getPath();
} catch(NullPointerException e)
{
throw new IllegalArgumentException("Missing parameter " + name, e);
diff --git a/src/main/java/io/sinistral/proteus/server/ServerRequest.java b/src/main/java/io/sinistral/proteus/server/ServerRequest.java
index 6d888cb..1cd724a 100644
--- a/src/main/java/io/sinistral/proteus/server/ServerRequest.java
+++ b/src/main/java/io/sinistral/proteus/server/ServerRequest.java
@@ -162,12 +162,16 @@ private void extractBytes() throws IOException
ByteBuffer buffer = ByteBuffer.allocate(pos);
- ByteBuffer src = buf.duplicate();
- src.position(0);
- src.limit(0 + pos);
- buffer.put(src);
+ int nTransfer = Math.min(buffer.remaining(), buf.remaining());
+ if (nTransfer > 0)
+ {
+ buffer.put(buf.array(),
+ buf.arrayOffset()+buf.position(),
+ nTransfer);
+ buf.position(buf.position()+nTransfer);
+ }
- //System.arraycopy(buf.array(), 0, buffer.array(), 0, pos);
+ // System.arraycopy(buf.array(), 0, buffer.array(), 0, pos);
exchange.putAttachment(BYTE_BUFFER_KEY, buffer);
@@ -188,7 +192,7 @@ private void parseMultipartForm() throws IOException
this.exchange.startBlocking();
final FormDataParser formDataParser = new MultiPartParserDefinition()
- .setTempFileLocation(new File(TMP_DIR))
+ .setTempFileLocation(new File(TMP_DIR).toPath())
.setDefaultEncoding(CHARSET)
.create(this.exchange);
diff --git a/src/main/java/io/sinistral/proteus/server/handlers/ServerDefaultResponseListener.java b/src/main/java/io/sinistral/proteus/server/handlers/ServerDefaultResponseListener.java
index 713995f..651d69b 100644
--- a/src/main/java/io/sinistral/proteus/server/handlers/ServerDefaultResponseListener.java
+++ b/src/main/java/io/sinistral/proteus/server/handlers/ServerDefaultResponseListener.java
@@ -20,7 +20,6 @@
import io.sinistral.proteus.server.predicates.ServerPredicates;
import io.undertow.server.DefaultResponseListener;
import io.undertow.server.HttpServerExchange;
-import io.undertow.util.AttachmentKey;
import io.undertow.util.Headers;
import io.undertow.util.StatusCodes;
@@ -34,8 +33,6 @@ public class ServerDefaultResponseListener implements DefaultResponseListener
private static Logger log = LoggerFactory.getLogger(ServerDefaultResponseListener.class.getCanonicalName());
- public static AttachmentKey EXCEPTION = AttachmentKey.create(Throwable.class);
-
@Inject
protected XmlMapper xmlMapper;
@@ -47,9 +44,9 @@ public boolean handleDefaultResponse(HttpServerExchange exchange)
return false;
}
- if (exchange.getResponseCode() >= 400) {
+ if (exchange.getStatusCode() >= 400) {
- Throwable throwable = exchange.getAttachment(EXCEPTION);
+ Throwable throwable = exchange.getAttachment(DefaultResponseListener.EXCEPTION);
if( throwable == null )
{
@@ -70,7 +67,7 @@ public boolean handleDefaultResponse(HttpServerExchange exchange)
if(throwable instanceof IllegalArgumentException )
{
- exchange.setResponseCode(StatusCodes.BAD_REQUEST);
+ exchange.setStatusCode(StatusCodes.BAD_REQUEST);
}
if( ServerPredicates.ACCEPT_XML_EXCLUSIVE_PREDICATE.resolve(exchange) )
diff --git a/src/main/java/io/sinistral/proteus/services/AssetsService.java b/src/main/java/io/sinistral/proteus/services/AssetsService.java
index f41861b..8b3975d 100644
--- a/src/main/java/io/sinistral/proteus/services/AssetsService.java
+++ b/src/main/java/io/sinistral/proteus/services/AssetsService.java
@@ -12,8 +12,7 @@
import com.typesafe.config.Config;
import io.sinistral.proteus.server.endpoints.EndpointInfo;
-import io.undertow.predicate.Predicate;
-import io.undertow.server.HttpServerExchange;
+import io.undertow.predicate.TruePredicate;
import io.undertow.server.RoutingHandler;
import io.undertow.server.handlers.resource.FileResourceManager;
import io.undertow.server.handlers.resource.ResourceHandler;
@@ -25,21 +24,7 @@
*/
public class AssetsService extends BaseService implements Supplier
{
- private static class TruePredicate implements Predicate {
- public static final TruePredicate INSTANCE = new TruePredicate();
-
- public static TruePredicate instance() {
- return INSTANCE;
- }
-
- @Override
- public boolean resolve(final HttpServerExchange value) {
- return true;
- }
-
- }
-
@Inject
@Named("registeredEndpoints")
protected Set registeredEndpoints;
@@ -66,9 +51,9 @@ public RoutingHandler get()
final String assetsDirectoryName = serviceConfig.getString("dir") ;
final Integer assetsCacheTime = serviceConfig.getInt("cache.time");
- final FileResourceManager fileResourceManager = new FileResourceManager(Paths.get(assetsDirectoryName).toFile(),1024l);
+ final FileResourceManager fileResourceManager = new FileResourceManager(Paths.get(assetsDirectoryName).toFile());
- 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)
));