ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gau...@apache.org
Subject incubator-ranger git commit: RANGER-863 : Make parameters like maxHttpHeaderSize configurable for EmbeddedServer
Date Sat, 05 Mar 2016 10:12:26 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 0fe605a97 -> f46c5cd91


RANGER-863 : Make parameters like maxHttpHeaderSize configurable for EmbeddedServer


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/f46c5cd9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/f46c5cd9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/f46c5cd9

Branch: refs/heads/master
Commit: f46c5cd910bbe52796d3555d55c381a8186eea4e
Parents: 0fe605a
Author: Pradeep Agrawal <pradeep.agrawal@freestoneinfotech.com>
Authored: Thu Mar 3 09:17:56 2016 +0530
Committer: Gautam Borad <gautam@apache.org>
Committed: Sat Mar 5 15:42:16 2016 +0530

----------------------------------------------------------------------
 .../ranger/server/tomcat/EmbeddedServer.java    | 37 +++++++++++++++++---
 1 file changed, 33 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/f46c5cd9/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
----------------------------------------------------------------------
diff --git a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
index fbd61f0..14e339f 100644
--- a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
+++ b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java
@@ -22,6 +22,7 @@ package org.apache.ranger.server.tomcat;
 import java.io.File;
 import java.net.URL;
 import java.util.Date;
+import java.util.Iterator;
 import java.util.Properties;
 import java.util.logging.Logger;
 
@@ -118,7 +119,7 @@ public class EmbeddedServer {
 			server.setConnector(ssl);
 			
 		}
-
+		updateHttpConnectorAttribConfig(server);
 		File baseDir = new File(".");
 		
 		File logDirectory = new File(baseDir, "logs");
@@ -347,7 +348,35 @@ public class EmbeddedServer {
 		}
 
 	}
-
-
-
+	protected long getLongConfig(String key, long defaultValue) {
+		long ret = 0;
+		String retStr = getConfig(key);
+		if (retStr == null) {
+		        ret = defaultValue;
+		} else {
+		        ret = Long.parseLong(retStr);
+		}
+		return ret;
+	}
+	public void updateHttpConnectorAttribConfig(Tomcat server) {
+		server.getConnector().setAllowTrace(Boolean.valueOf(getConfig("ranger.service.http.connector.attrib.allowTrace","false")));
+		server.getConnector().setAsyncTimeout(getLongConfig("ranger.service.http.connector.attrib.asyncTimeout",
10000));
+		server.getConnector().setEnableLookups(Boolean.valueOf(getConfig("ranger.service.http.connector.attrib.enableLookups","false")));
+		server.getConnector().setMaxHeaderCount(getIntConfig("ranger.service.http.connector.attrib.maxHeaderCount",
100));
+		server.getConnector().setMaxParameterCount(getIntConfig("ranger.service.http.connector.attrib.maxParameterCount",
10000));
+		server.getConnector().setMaxPostSize(getIntConfig("ranger.service.http.connector.attrib.maxPostSize",
2097152));
+		server.getConnector().setMaxSavePostSize(getIntConfig("ranger.service.http.connector.attrib.maxSavePostSize",
4096));
+		server.getConnector().setParseBodyMethods(getConfig("ranger.service.http.connector.attrib.methods",
"POST"));
+		Iterator<Object> iterator=serverConfigProperties.keySet().iterator();
+		String key=null;
+		String property=null;
+		while (iterator.hasNext()){
+		        key=iterator.next().toString();
+		        if(key!=null && key.startsWith("ranger.service.http.connector.property.")){
+		                property=key.replace("ranger.service.http.connector.property.","");
+		                server.getConnector().setProperty(property,getConfig(key));
+		                LOG.info(property+":"+server.getConnector().getProperty(property));
+		        }
+		}
+	}
 }


Mime
View raw message