You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by di...@apache.org on 2013/09/28 07:30:11 UTC
[1/2] git commit: knox-157,
Knox is not able to process PUT/POST requests with large payload
Updated Branches:
refs/heads/master 75c829edd -> 58fbc94e3
knox-157, Knox is not able to process PUT/POST requests with large payload
Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/58fbc94e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/58fbc94e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/58fbc94e
Branch: refs/heads/master
Commit: 58fbc94e34987d1ed209d1b501d334e7818f5acd
Parents: b728b48
Author: Dilli Dorai Arumugam <da...@hortonworks.com>
Authored: Fri Sep 27 22:27:35 2013 -0700
Committer: Dilli Dorai Arumugam <da...@hortonworks.com>
Committed: Fri Sep 27 22:27:54 2013 -0700
----------------------------------------------------------------------
.../gateway/dispatch/HttpClientDispatch.java | 58 +-------------------
1 file changed, 2 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/58fbc94e/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
index 4ef336a..7613f2a 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/HttpClientDispatch.java
@@ -173,7 +173,6 @@ public class HttpClientDispatch extends AbstractGatewayDispatch {
throws IOException {
String contentType = request.getContentType();
-// String contentEncoding = request.getCharacterEncoding();
int contentLength = request.getContentLength();
InputStream contentStream = request.getInputStream();
@@ -183,45 +182,11 @@ public class HttpClientDispatch extends AbstractGatewayDispatch {
} else {
entity = new InputStreamEntity(contentStream, contentLength, ContentType.parse( contentType ) );
}
- //TODO: Need a better solution than this for replaying bodies when required.
- // Perhaps we should pessimistically buffer the first REPLAY_BUFFER_MAX_SIZE bytes and then
- // switch to the remaining stream once that is consumed. The buffer size would probably need
- // to match the underlying socket buffer size for this to be meaningful.
- // This would require writing a special version of HttpEntity/BufferedHttpEntity.
- // Might also look into mark()/reset() as a solution.
- if( contentLength <= REPLAY_BUFFER_MAX_SIZE ) {
+
+ if ("true".equals(System.getProperty(GatewayConfig.HADOOP_KERBEROS_SECURED))) {
entity = new BufferedHttpEntity( entity );
}
-// HttpEntity entity = null;
-// if ((contentType != null)
-// && (contentType.startsWith(CT_APP_WWW_FORM_URL_ENCODED) ||
-// contentType.equalsIgnoreCase(CT_APP_XML))) {
-// if (contentLength <= REPLAY_BUFFER_MAX_SIZE) {
-// if (contentEncoding == null) {
-// contentEncoding = Charset.defaultCharset().name();
-// }
-// String body = IOUtils.toString(contentStream, contentEncoding);
-// // ASCII is OK here because the urlEncode about should have already
-// // escaped
-// byte[] bodyBytes = body.getBytes("US-ASCII");
-// ContentType ct = contentType.equalsIgnoreCase(CT_APP_XML) ? ContentType.APPLICATION_XML
-// : ContentType.APPLICATION_FORM_URLENCODED;
-// entity = new ByteArrayEntity(bodyBytes, ct);
-// } else {
-// entity = new InputStreamEntity(contentStream, contentLength);
-// }
-// } else {
-// InputStreamEntity streamEntity = new RepeatableInputStreamEntity(
-// contentStream, contentLength);
-// if (contentType != null) {
-// streamEntity.setContentType(contentType);
-// }
-// if (contentEncoding != null) {
-// streamEntity.setContentEncoding(contentEncoding);
-// }
-// entity = streamEntity;
-// }
return entity;
}
@@ -269,24 +234,5 @@ public class HttpClientDispatch extends AbstractGatewayDispatch {
copyRequestHeaderFields( method, request );
executeRequest( method, request, response );
}
-
-// private static class RepeatableInputStreamEntity extends InputStreamEntity {
-//
-// public RepeatableInputStreamEntity(InputStream contentStream,
-// int contentLength) {
-// super(contentStream, contentLength);
-// }
-//
-// @Override
-// public boolean isRepeatable() {
-// return true;
-// }
-//
-// @Override
-// public InputStream getContent() throws IOException {
-// return super.getContent();
-// }
-//
-// }
}
[2/2] git commit: knox-163,
job submission through knox-webchat results in NullPointerException
Posted by di...@apache.org.
knox-163, job submission through knox-webchat results in NullPointerException
Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/b728b48a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/b728b48a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/b728b48a
Branch: refs/heads/master
Commit: b728b48a79e5b249a86773209ec4160a254becfa
Parents: 75c829e
Author: Dilli Dorai Arumugam <da...@hortonworks.com>
Authored: Fri Sep 27 10:51:28 2013 -0700
Committer: Dilli Dorai Arumugam <da...@hortonworks.com>
Committed: Fri Sep 27 22:27:54 2013 -0700
----------------------------------------------------------------------
...entityAsserterHttpServletRequestWrapper.java | 36 +++++++++++---------
1 file changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/b728b48a/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java b/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
index c41d109..6e8d153 100644
--- a/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
+++ b/gateway-provider-identity-assertion-pseudo/src/main/java/org/apache/hadoop/gateway/identityasserter/filter/IdentityAsserterHttpServletRequestWrapper.java
@@ -99,16 +99,7 @@ public class IdentityAsserterHttpServletRequestWrapper extends HttpServletReques
else {
params = parseQueryString(qString);
}
- }
- ArrayList<String> al = new ArrayList<String>();
- al.add(username);
- String[] a = {""};
-
- if ("true".equals(System.getProperty(GatewayConfig.HADOOP_KERBEROS_SECURED))) {
- params.put(DOAS_PRINCIPAL_PARAM, al.toArray(a));
- } else {
- params.put(PRINCIPAL_PARAM, al.toArray(a));
- }
+ }
return params;
}
@@ -120,13 +111,26 @@ public class IdentityAsserterHttpServletRequestWrapper extends HttpServletReques
public String getQueryString() {
String q = null;
Map<String, String[]> params = getParams();
- if (params != null) {
- String encoding = getCharacterEncoding();
- if( encoding == null ) {
- encoding = Charset.defaultCharset().name();
- }
- q = urlEncode( params, encoding );
+
+ if (params == null) {
+ params = new HashMap<String, String[]>();
+ }
+
+ ArrayList<String> al = new ArrayList<String>();
+ al.add(username);
+ String[] a = { "" };
+
+ if ("true".equals(System.getProperty(GatewayConfig.HADOOP_KERBEROS_SECURED))) {
+ params.put(DOAS_PRINCIPAL_PARAM, al.toArray(a));
+ } else {
+ params.put(PRINCIPAL_PARAM, al.toArray(a));
+ }
+
+ String encoding = getCharacterEncoding();
+ if (encoding == null) {
+ encoding = Charset.defaultCharset().name();
}
+ q = urlEncode(params, encoding);
return q;
}