Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- use a static DiskFileItemFactory (one instantiation is enough) - use more memory for the DiskFileItemFactory to avoid IO when POST commands come

orbiter94b2a664f38e
diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java
index 42706c8db..3e711e7b9 100644
--- a/source/de/anomic/http/server/HTTPDFileHandler.java
+++ b/source/de/anomic/http/server/HTTPDFileHandler.java
@@ -71,7 +71,6 @@ import java.io.UnsupportedEncodingException;
import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.net.InetAddress;
import java.net.URLDecoder;
import java.util.Date;
import java.util.HashMap;
diff --git a/source/de/anomic/http/server/HTTPDemon.java b/source/de/anomic/http/server/HTTPDemon.java
index abb3a8f78..a0acd129b 100644
--- a/source/de/anomic/http/server/HTTPDemon.java
+++ b/source/de/anomic/http/server/HTTPDemon.java
@@ -99,6 +99,8 @@ public final class HTTPDemon implements serverHandler, Cloneable {
public static final int ERRORCASE_MESSAGE = 4;
public static final int ERRORCASE_FILE = 5;
private static File TMPDIR = new File(System.getProperty("java.io.tmpdir"));
+ private static FileItemFactory diskFileItemFactory = new DiskFileItemFactory(5 * 1024 * 1024, TMPDIR);
+
private static AlternativeDomainNames alternativeResolver = null;
/**
@@ -901,8 +903,7 @@ public final class HTTPDemon implements serverHandler, Cloneable {
}
// parse data in memory
- FileItemFactory factory = new DiskFileItemFactory(1024 * 1024, TMPDIR);
- FileUpload upload = new FileUpload(factory);
+ FileUpload upload = new FileUpload(diskFileItemFactory);
List<FileItem> items;
try {
items = upload.parseRequest(request);