Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
remove the overhead of unused reverseMappingCache of HeaderFramewor / RequestHeader
reger6be7339b1d9b
diff --git a/source/net/yacy/cora/protocol/HeaderFramework.java b/source/net/yacy/cora/protocol/HeaderFramework.javaindex 415eb4937..f3a7033b1 100644--- a/source/net/yacy/cora/protocol/HeaderFramework.java+++ b/source/net/yacy/cora/protocol/HeaderFramework.java@@ -47,9 +47,6 @@ import net.yacy.cora.util.ConcurrentLog;* keys are not compared by the equal() method, but are always* treated as string and compared as* key.uppercase().equal(.uppercase(comparator))- * You use this class by first creation of a static HashMap- * that then is used a the reverse mapping cache for every new- * instance of this class.*/public class HeaderFramework extends TreeMap<String, String> implements Map<String, String> {@@ -211,26 +208,13 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stripublic static final String CONNECTION_PROP_PROXY_RESPOND_HEADER = "PROXY_RESPOND_HEADER";public static final String CONNECTION_PROP_PROXY_RESPOND_SIZE = "PROXY_REQUEST_SIZE";- private final Map<String, String> reverseMappingCache;-public HeaderFramework() {- this(null);- }-- public HeaderFramework(final Map<String, String> reverseMappingCache) {- // this creates a new TreeMap with a case insensitive mapping- // to provide a put-method that translates given keys into their- // 'proper' appearance, a translation cache is needed.- // upon instantiation, such a mapping cache can be handed over- // If the reverseMappingCache is null, none is usedsuper(ASCII.insensitiveASCIIComparator);- this.reverseMappingCache = reverseMappingCache;}- public HeaderFramework(final Map<String, String> reverseMappingCache, final Map<String, String> othermap) {+ public HeaderFramework(final Map<String, String> othermap) {// creates a case insensitive map from another mapsuper(ASCII.insensitiveASCIIComparator);- this.reverseMappingCache = reverseMappingCache;// load with dataif (othermap != null) putAll(othermap);@@ -304,26 +288,6 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Strireturn null;}- // we override the put method to make use of the reverseMappingCache- @Override- public String put(final String key, final String value) {- final String upperK = key.toUpperCase();-- if (this.reverseMappingCache == null) {- return super.put(key, value);- }-- if (this.reverseMappingCache.containsKey(upperK)) {- // we put in the value using the reverse mapping- return super.put(this.reverseMappingCache.get(upperK), value);- }-- // we put in without a cached key and store the key afterwards- final String r = super.put(key, value);- this.reverseMappingCache.put(upperK, key);- return r;- }-// to make the occurrence of multiple keys possible, we add them using a counterpublic String add(final String key, final String value) {final int c = keyCount(key);diff --git a/source/net/yacy/cora/protocol/RequestHeader.java b/source/net/yacy/cora/protocol/RequestHeader.javaindex 4c4622097..bfdfb2e1a 100644--- a/source/net/yacy/cora/protocol/RequestHeader.java+++ b/source/net/yacy/cora/protocol/RequestHeader.java@@ -452,6 +452,7 @@ public class RequestHeader extends HeaderFramework implements HttpServletRequest}}+ @Deprecated // As of Version 2.1 of the Java Servlet API, use isRequestedSessionIdFromURL() instead.@Overridepublic boolean isRequestedSessionIdFromUrl() {if (_request != null) {diff --git a/source/net/yacy/cora/protocol/ResponseHeader.java b/source/net/yacy/cora/protocol/ResponseHeader.javaindex 9503c6ca0..f5112ac6c 100644--- a/source/net/yacy/cora/protocol/ResponseHeader.java+++ b/source/net/yacy/cora/protocol/ResponseHeader.java@@ -22,7 +22,6 @@ package net.yacy.cora.protocol;import java.util.ArrayList;import java.util.Date;-import java.util.HashMap;import java.util.List;import java.util.Map;import javax.servlet.http.Cookie;@@ -53,13 +52,8 @@ public class ResponseHeader extends HeaderFramework {}}- public ResponseHeader(final int statusCode, final HashMap<String, String> reverseMappingCache) {- super(reverseMappingCache);- this.put(HeaderFramework.STATUS_CODE, Integer.toString(statusCode));- }-- public ResponseHeader(final HashMap<String, String> reverseMappingCache, final Map<String, String> othermap) {- super(reverseMappingCache, othermap);+ public ResponseHeader(final Map<String, String> othermap) {+ super(othermap);}public int getStatusCode() {