You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/01/30 19:55:41 UTC
[2/2] hbase git commit: Revert "Revert "HBASE-12894 Upgrade to Jetty
9 for REST / Info Server / Thrift Http Server""
Revert "Revert "HBASE-12894 Upgrade to Jetty 9 for REST / Info Server / Thrift Http Server""
This reverts commit 0ac5d4a7171833d33b35c09a3f5f3ca3ee5cd4d1.
This is a revert of a revert; i.e. a reapplication!
Fixes for breakage that comes in with this patch is in a follow-on.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ffe7dac5
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ffe7dac5
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ffe7dac5
Branch: refs/heads/master
Commit: ffe7dac53d7824b4fb97b2aa642108a58b23afc8
Parents: f576f46
Author: Michael Stack <st...@apache.org>
Authored: Mon Jan 30 11:54:54 2017 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Mon Jan 30 11:54:54 2017 -0800
----------------------------------------------------------------------
hbase-common/pom.xml | 4 -
hbase-it/pom.xml | 5 -
.../src/main/resources/META-INF/LICENSE.vm | 2 +-
.../src/main/resources/META-INF/NOTICE.vm | 14 +-
.../src/main/resources/supplemental-models.xml | 468 +++++++++++++++++++
hbase-rest/pom.xml | 68 +--
.../org/apache/hadoop/hbase/rest/Constants.java | 10 +
.../apache/hadoop/hbase/rest/RESTServer.java | 197 +++++---
.../hadoop/hbase/rest/RESTServletContainer.java | 2 +-
.../hbase/rest/filter/GZIPRequestStream.java | 16 +
.../hbase/rest/filter/GZIPResponseStream.java | 11 +
.../hadoop/hbase/rest/model/ScannerModel.java | 45 +-
.../rest/provider/JAXBContextResolver.java | 6 +-
.../hbase/rest/provider/JacksonProvider.java | 31 --
.../producer/PlainTextMessageBodyProducer.java | 11 +-
.../producer/ProtobufMessageBodyProducer.java | 17 +-
.../hbase/rest/HBaseRESTTestingUtility.java | 66 ++-
.../hadoop/hbase/rest/RowResourceBase.java | 6 +-
.../hadoop/hbase/rest/TestGzipFilter.java | 15 -
.../hadoop/hbase/rest/TestMultiRowResource.java | 6 +-
.../rest/TestNamespacesInstanceResource.java | 8 +-
.../hbase/rest/TestScannersWithLabels.java | 2 +-
.../apache/hadoop/hbase/rest/TestTableScan.java | 8 +-
hbase-server/pom.xml | 76 ++-
.../hadoop/hbase/http/HttpRequestLog.java | 5 +-
.../apache/hadoop/hbase/http/HttpServer.java | 308 +++++-------
.../jetty/SslSelectChannelConnectorSecure.java | 36 --
.../hadoop/hbase/util/HttpServerUtil.java | 20 +-
.../hadoop/hbase/http/TestHttpRequestLog.java | 5 +-
.../hadoop/hbase/http/TestHttpServer.java | 19 +-
.../hadoop/hbase/http/TestServletFilter.java | 2 +-
hbase-spark/pom.xml | 1 -
hbase-thrift/pom.xml | 34 +-
.../hadoop/hbase/thrift/ThriftServerRunner.java | 115 +++--
pom.xml | 152 +++---
35 files changed, 1087 insertions(+), 704 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-common/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-common/pom.xml b/hbase-common/pom.xml
index b46be6d..cf2772e 100644
--- a/hbase-common/pom.xml
+++ b/hbase-common/pom.xml
@@ -253,10 +253,6 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </dependency>
<!-- tracing Dependencies -->
<dependency>
<groupId>org.apache.htrace</groupId>
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-it/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-it/pom.xml b/hbase-it/pom.xml
index 09118b1..55240a9 100644
--- a/hbase-it/pom.xml
+++ b/hbase-it/pom.xml
@@ -232,11 +232,6 @@
<artifactId>guava</artifactId>
</dependency>
<dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
----------------------------------------------------------------------
diff --git a/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
index 688310f..a9f0c81 100644
--- a/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
+++ b/hbase-resource-bundle/src/main/resources/META-INF/LICENSE.vm
@@ -1563,7 +1563,7 @@ You can redistribute it and/or modify it under either the terms of the GPL
## license mentions.
##
## See this FAQ link for justifications: https://www.apache.org/legal/resolved.html
-#set($non_aggregate_fine = [ 'Public Domain', 'New BSD license', 'BSD license', 'Mozilla Public License Version 2.0', 'Creative Commons Attribution License, Version 2.5', 'MPL 1.1'])
+#set($non_aggregate_fine = [ 'Public Domain', 'New BSD license', 'BSD license', 'Mozilla Public License Version 1.1', 'Mozilla Public License Version 2.0', 'Creative Commons Attribution License, Version 2.5', 'Eclipse Public License 1.0'])
## include LICENSE sections for anything not under ASL2.0
#foreach( ${dep} in ${projects} )
## if there are no licenses we'll fail the build later, so
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
----------------------------------------------------------------------
diff --git a/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
index 53fb51e..4be6017 100644
--- a/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
+++ b/hbase-resource-bundle/src/main/resources/META-INF/NOTICE.vm
@@ -101,21 +101,13 @@ noted in the LICENSE file.
## Leave out all the 'optionally depends on' bits.
#end
-## NOTICE.txt from jetty 6.1.26, which isn't in the org.mortbay.jetty:jetty-util jar
-## Obtained from fedora's mirror of the 6.1.26 source
-## http://pkgs.fedoraproject.org/repo/pkgs/jetty/jetty-6.1.26-src.zip/
-## 4980757517064efbf655e025d005a0b8/jetty-6.1.26-src.zip
-## https://github.com/toddlipcon/jetty-hadoop-fix/tree/6.1.26
-##
-## updated for server side to include jsp bits from 6.1.14 (notice files are identical save
-## copyright span)
+
#macro(jetty_notice $jetty-include-unixcrypt)
--
This product includes portions of 'The Jetty Web Container'
-Copyright 1995-2009 Mort Bay Consulting Pty Ltd
+Copyright 1995-2016 Mort Bay Consulting Pty Ltd.
-## javax.servlet paragraph is generated via org.mortbay.jetty:servlet-api-2.5
#if(${jetty-include-unixcrypt})
## UnixCrypt.java paragraph only in server
The UnixCrypt.java code ~Implements the one way cryptography used by
@@ -126,7 +118,7 @@ for non-commercial or commercial purposes and without fee is
granted provided that the copyright notice appears in all copies.
#end
-## jsp implementation paragraph is handled via org.mortbay.jetty:jsp-2.1
+## jsp implementation paragraph is handled via org.eclipse.jetty:jetty-jsp:jar
Some portions of the code are Copyright:
2006 Tim Vernum
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-resource-bundle/src/main/resources/supplemental-models.xml
----------------------------------------------------------------------
diff --git a/hbase-resource-bundle/src/main/resources/supplemental-models.xml b/hbase-resource-bundle/src/main/resources/supplemental-models.xml
index e1de3c7..ab99443 100644
--- a/hbase-resource-bundle/src/main/resources/supplemental-models.xml
+++ b/hbase-resource-bundle/src/main/resources/supplemental-models.xml
@@ -152,6 +152,214 @@ under the License.
</supplement>
<supplement>
<project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-http</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-io</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jmx</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util-ajax</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-xml</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jsp</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-security</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty.orbit</groupId>
+ <artifactId>javax.servlet.jsp.jstl</artifactId>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty.orbit</groupId>
+ <artifactId>org.eclipse.jdt.core</artifactId>
+
+ <licenses>
+ <license>
+ <name>Eclipse Public License 1.0</name>
+ <url>http://www.eclipse.org/legal/epl-v10.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.eclipse.jetty.toolchain</groupId>
+ <artifactId>jetty-schemas</artifactId>
+ <licenses>
+ <license>
+ <name>Common Development and Distribution License (CDDL) v1.0</name>
+ <url>https://glassfish.dev.java.net/public/CDDLv1.0.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
@@ -589,6 +797,266 @@ under the License.
</supplement>
<supplement>
<project>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <licenses>
+ <license>
+ <name>Common Development and Distribution License (CDDL) v1.0</name>
+ <url>https://glassfish.dev.java.net/public/CDDLv1.0.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <licenses>
+ <license>
+ <name>Common Development and Distribution License (CDDL) v1.0</name>
+ <url>https://glassfish.dev.java.net/public/CDDLv1.0.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>javax.servlet.jsp-api</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.el</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-api</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-locator</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>hk2-utils</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>osgi-resource-locator</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.hk2.external</groupId>
+ <artifactId>aopalliance-repackaged</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.hk2.external</groupId>
+ <artifactId>javax.inject</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.bundles.repackaged</groupId>
+ <artifactId>jersey-guava</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-server</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-jaxb</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson1</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>javax.servlet.jsp</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>javax.servlet.jsp.jstl</artifactId>
+ <licenses>
+ <license>
+ <name>CDDL 1.1</name>
+ <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml
index 53fbad4..18e9da5 100644
--- a/hbase-rest/pom.xml
+++ b/hbase-rest/pom.xml
@@ -235,20 +235,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-2.1</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-compiler</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-runtime</artifactId>
- </dependency>
<!-- REST dependencies -->
<dependency>
<groupId>com.google.guava</groupId>
@@ -259,18 +245,6 @@
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-json</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- </dependency>
- <dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
@@ -295,38 +269,44 @@
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-sslengine</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-http</artifactId>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.1</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-io</artifactId>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jmx</artifactId>
</dependency>
- <!-- test dependencies -->
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <scope>test</scope>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jsp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson1</artifactId>
</dependency>
</dependencies>
<profiles>
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java
index 54ce117..ea8bc9c 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java
@@ -54,6 +54,16 @@ public interface Constants {
String REST_SSL_KEYSTORE_STORE = "hbase.rest.ssl.keystore.store";
String REST_SSL_KEYSTORE_PASSWORD = "hbase.rest.ssl.keystore.password";
String REST_SSL_KEYSTORE_KEYPASSWORD = "hbase.rest.ssl.keystore.keypassword";
+ String REST_SSL_EXCLUDE_CIPHER_SUITES = "hbase.rest.ssl.exclude.cipher.suites";
+ String REST_SSL_INCLUDE_CIPHER_SUITES = "hbase.rest.ssl.include.cipher.suites";
+ String REST_SSL_EXCLUDE_PROTOCOLS = "hbase.rest.ssl.exclude.protocols";
+ String REST_SSL_INCLUDE_PROTOCOLS = "hbase.rest.ssl.include.protocols";
+
+ String REST_THREAD_POOL_THREADS_MAX = "hbase.rest.threads.max";
+ String REST_THREAD_POOL_THREADS_MIN = "hbase.rest.threads.min";
+ String REST_THREAD_POOL_TASK_QUEUE_SIZE = "hbase.rest.task.queue.size";
+ String REST_THREAD_POOL_THREAD_IDLE_TIMEOUT = "hbase.rest.thread.idle.timeout";
+ String REST_CONNECTOR_ACCEPT_QUEUE_SIZE = "hbase.rest.connector.accept.queue.size";
String REST_DNS_NAMESERVER = "hbase.rest.dns.nameserver";
String REST_DNS_INTERFACE = "hbase.rest.dns.interface";
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java
index 7cec152..4ab194c 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java
@@ -18,12 +18,14 @@
package org.apache.hadoop.hbase.rest;
+import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
+import java.util.EnumSet;
+import java.util.concurrent.ArrayBlockingQueue;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
@@ -37,9 +39,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
-import org.apache.hadoop.hbase.http.HttpServer;
import org.apache.hadoop.hbase.http.InfoServer;
-import org.apache.hadoop.hbase.jetty.SslSelectChannelConnectorSecure;
import org.apache.hadoop.hbase.rest.filter.AuthFilter;
import org.apache.hadoop.hbase.rest.filter.RestCsrfPreventionFilter;
import org.apache.hadoop.hbase.security.UserProvider;
@@ -49,17 +49,28 @@ import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.Strings;
import org.apache.hadoop.hbase.util.VersionInfo;
import org.apache.hadoop.util.StringUtils;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.thread.QueuedThreadPool;
import com.google.common.base.Preconditions;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
+
+import org.eclipse.jetty.http.HttpVersion;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.jmx.MBeanContainer;
+import org.eclipse.jetty.servlet.FilterHolder;
+
+import org.glassfish.jersey.jackson1.Jackson1Feature;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+
+import javax.servlet.DispatcherType;
/**
* Main class for launching REST gateway as a servlet hosted by Jetty.
@@ -82,6 +93,8 @@ public class RESTServer implements Constants {
static String REST_CSRF_METHODS_TO_IGNORE_KEY = "hbase.rest.csrf.methods.to.ignore";
static String REST_CSRF_METHODS_TO_IGNORE_DEFAULT = "GET,OPTIONS,HEAD,TRACE";
+ private static final String PATH_SPEC_ANY = "/*";
+
private static void printUsageAndExit(Options options, int exitCode) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("hbase rest start", "", options,
@@ -109,17 +122,19 @@ public class RESTServer implements Constants {
}
static String REST_CSRF_BROWSER_USERAGENTS_REGEX_KEY = "hbase.rest-csrf.browser-useragents-regex";
- static void addCSRFFilter(Context context, Configuration conf) {
+ static void addCSRFFilter(ServletContextHandler ctxHandler, Configuration conf) {
restCSRFEnabled = conf.getBoolean(REST_CSRF_ENABLED_KEY, REST_CSRF_ENABLED_DEFAULT);
if (restCSRFEnabled) {
- String[] urls = { "/*" };
Set<String> restCsrfMethodsToIgnore = new HashSet<>();
restCsrfMethodsToIgnore.addAll(getTrimmedStringList(conf,
- REST_CSRF_METHODS_TO_IGNORE_KEY, REST_CSRF_METHODS_TO_IGNORE_DEFAULT));
+ REST_CSRF_METHODS_TO_IGNORE_KEY, REST_CSRF_METHODS_TO_IGNORE_DEFAULT));
Map<String, String> restCsrfParams = RestCsrfPreventionFilter
.getFilterParams(conf, "hbase.rest-csrf.");
- HttpServer.defineFilter(context, "csrf", RestCsrfPreventionFilter.class.getName(),
- restCsrfParams, urls);
+ FilterHolder holder = new FilterHolder();
+ holder.setName("csrf");
+ holder.setClassName(RestCsrfPreventionFilter.class.getName());
+ holder.setInitParameters(restCsrfParams);
+ ctxHandler.addFilter(holder, PATH_SPEC_ANY, EnumSet.allOf(DispatcherType.class));
}
}
@@ -143,10 +158,10 @@ public class RESTServer implements Constants {
FilterHolder authFilter = new FilterHolder();
authFilter.setClassName(AuthFilter.class.getName());
authFilter.setName("AuthenticationFilter");
- return new Pair<FilterHolder, Class<? extends ServletContainer>>(authFilter,containerClass);
+ return new Pair<>(authFilter,containerClass);
}
}
- return new Pair<FilterHolder, Class<? extends ServletContainer>>(null, containerClass);
+ return new Pair<>(null, containerClass);
}
private static void parseCommandLine(String[] args, RESTServlet servlet) {
@@ -220,76 +235,106 @@ public class RESTServer implements Constants {
Pair<FilterHolder, Class<? extends ServletContainer>> pair = loginServerPrincipal(
userProvider, conf);
FilterHolder authFilter = pair.getFirst();
- Class<? extends ServletContainer> containerClass = pair.getSecond();
RESTServlet servlet = RESTServlet.getInstance(conf, userProvider);
parseCommandLine(args, servlet);
// set up the Jersey servlet container for Jetty
- ServletHolder sh = new ServletHolder(containerClass);
- sh.setInitParameter(
- "com.sun.jersey.config.property.resourceConfigClass",
- ResourceConfig.class.getCanonicalName());
- sh.setInitParameter("com.sun.jersey.config.property.packages",
- "jetty");
- // The servlet holder below is instantiated to only handle the case
- // of the /status/cluster returning arrays of nodes (live/dead). Without
- // this servlet holder, the problem is that the node arrays in the response
- // are collapsed to single nodes. We want to be able to treat the
- // node lists as POJO in the response to /status/cluster servlet call,
- // but not change the behavior for any of the other servlets
- // Hence we don't use the servlet holder for all servlets / paths
- ServletHolder shPojoMap = new ServletHolder(containerClass);
- @SuppressWarnings("unchecked")
- Map<String, String> shInitMap = sh.getInitParameters();
- for (Entry<String, String> e : shInitMap.entrySet()) {
- shPojoMap.setInitParameter(e.getKey(), e.getValue());
- }
- shPojoMap.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true");
+ ResourceConfig application = new ResourceConfig().
+ packages("org.apache.hadoop.hbase.rest").register(Jackson1Feature.class);
+ ServletHolder sh = new ServletHolder(new ServletContainer(application));
+
+ // Set the default max thread number to 100 to limit
+ // the number of concurrent requests so that REST server doesn't OOM easily.
+ // Jetty set the default max thread number to 250, if we don't set it.
+ //
+ // Our default min thread number 2 is the same as that used by Jetty.
+ int maxThreads = servlet.getConfiguration().getInt(REST_THREAD_POOL_THREADS_MAX, 100);
+ int minThreads = servlet.getConfiguration().getInt(REST_THREAD_POOL_THREADS_MIN, 2);
+ // Use the default queue (unbounded with Jetty 9.3) if the queue size is negative, otherwise use
+ // bounded {@link ArrayBlockingQueue} with the given size
+ int queueSize = servlet.getConfiguration().getInt(REST_THREAD_POOL_TASK_QUEUE_SIZE, -1);
+ int idleTimeout = servlet.getConfiguration().getInt(REST_THREAD_POOL_THREAD_IDLE_TIMEOUT, 60000);
+ QueuedThreadPool threadPool = queueSize > 0 ?
+ new QueuedThreadPool(maxThreads, minThreads, idleTimeout, new ArrayBlockingQueue<Runnable>(queueSize)) :
+ new QueuedThreadPool(maxThreads, minThreads, idleTimeout);
- // set up Jetty and run the embedded server
+ Server server = new Server(threadPool);
- Server server = new Server();
+ // Setup JMX
+ MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
+ server.addEventListener(mbContainer);
+ server.addBean(mbContainer);
- Connector connector = new SelectChannelConnector();
- if(conf.getBoolean(REST_SSL_ENABLED, false)) {
- SslSelectChannelConnectorSecure sslConnector = new SslSelectChannelConnectorSecure();
+
+ String host = servlet.getConfiguration().get("hbase.rest.host", "0.0.0.0");
+ int servicePort = servlet.getConfiguration().getInt("hbase.rest.port", 8080);
+ HttpConfiguration httpConfig = new HttpConfiguration();
+ httpConfig.setSecureScheme("https");
+ httpConfig.setSecurePort(servicePort);
+ httpConfig.setSendServerVersion(false);
+ httpConfig.setSendDateHeader(false);
+
+ ServerConnector serverConnector;
+ if (conf.getBoolean(REST_SSL_ENABLED, false)) {
+ HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
+ httpsConfig.addCustomizer(new SecureRequestCustomizer());
+
+ SslContextFactory sslCtxFactory = new SslContextFactory();
String keystore = conf.get(REST_SSL_KEYSTORE_STORE);
String password = HBaseConfiguration.getPassword(conf,
- REST_SSL_KEYSTORE_PASSWORD, null);
+ REST_SSL_KEYSTORE_PASSWORD, null);
String keyPassword = HBaseConfiguration.getPassword(conf,
- REST_SSL_KEYSTORE_KEYPASSWORD, password);
- sslConnector.setKeystore(keystore);
- sslConnector.setPassword(password);
- sslConnector.setKeyPassword(keyPassword);
- connector = sslConnector;
+ REST_SSL_KEYSTORE_KEYPASSWORD, password);
+ sslCtxFactory.setKeyStorePath(keystore);
+ sslCtxFactory.setKeyStorePassword(password);
+ sslCtxFactory.setKeyManagerPassword(keyPassword);
+
+ String[] excludeCiphers = servlet.getConfiguration().getStrings(
+ REST_SSL_EXCLUDE_CIPHER_SUITES, ArrayUtils.EMPTY_STRING_ARRAY);
+ if (excludeCiphers.length != 0) {
+ sslCtxFactory.setExcludeCipherSuites(excludeCiphers);
+ }
+ String[] includeCiphers = servlet.getConfiguration().getStrings(
+ REST_SSL_INCLUDE_CIPHER_SUITES, ArrayUtils.EMPTY_STRING_ARRAY);
+ if (includeCiphers.length != 0) {
+ sslCtxFactory.setIncludeCipherSuites(includeCiphers);
+ }
+
+ String[] excludeProtocols = servlet.getConfiguration().getStrings(
+ REST_SSL_EXCLUDE_PROTOCOLS, ArrayUtils.EMPTY_STRING_ARRAY);
+ if (excludeProtocols.length != 0) {
+ sslCtxFactory.setExcludeProtocols(excludeProtocols);
+ }
+ String[] includeProtocols = servlet.getConfiguration().getStrings(
+ REST_SSL_INCLUDE_PROTOCOLS, ArrayUtils.EMPTY_STRING_ARRAY);
+ if (includeProtocols.length != 0) {
+ sslCtxFactory.setIncludeProtocols(includeProtocols);
+ }
+
+ serverConnector = new ServerConnector(server,
+ new SslConnectionFactory(sslCtxFactory, HttpVersion.HTTP_1_1.toString()),
+ new HttpConnectionFactory(httpsConfig));
+ } else {
+ serverConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
}
- connector.setPort(servlet.getConfiguration().getInt("hbase.rest.port", DEFAULT_LISTEN_PORT));
- connector.setHost(servlet.getConfiguration().get("hbase.rest.host", "0.0.0.0"));
- connector.setHeaderBufferSize(65536);
- server.addConnector(connector);
+ int acceptQueueSize = servlet.getConfiguration().getInt(REST_CONNECTOR_ACCEPT_QUEUE_SIZE, -1);
+ if (acceptQueueSize >= 0) {
+ serverConnector.setAcceptQueueSize(acceptQueueSize);
+ }
- // Set the default max thread number to 100 to limit
- // the number of concurrent requests so that REST server doesn't OOM easily.
- // Jetty set the default max thread number to 250, if we don't set it.
- //
- // Our default min thread number 2 is the same as that used by Jetty.
- int maxThreads = servlet.getConfiguration().getInt("hbase.rest.threads.max", 100);
- int minThreads = servlet.getConfiguration().getInt("hbase.rest.threads.min", 2);
- QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads);
- threadPool.setMinThreads(minThreads);
- server.setThreadPool(threadPool);
-
- server.setSendServerVersion(false);
- server.setSendDateHeader(false);
+ serverConnector.setPort(servicePort);
+ serverConnector.setHost(host);
+
+ server.addConnector(serverConnector);
server.setStopAtShutdown(true);
- // set up context
- Context context = new Context(server, "/", Context.SESSIONS);
- context.addServlet(shPojoMap, "/status/cluster");
- context.addServlet(sh, "/*");
+
+ // set up context
+ ServletContextHandler ctxHandler = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
+ ctxHandler.addServlet(sh, PATH_SPEC_ANY);
if (authFilter != null) {
- context.addFilter(authFilter, "/*", 1);
+ ctxHandler.addFilter(authFilter, PATH_SPEC_ANY, EnumSet.of(DispatcherType.REQUEST));
}
// Load filters from configuration.
@@ -297,10 +342,10 @@ public class RESTServer implements Constants {
ArrayUtils.EMPTY_STRING_ARRAY);
for (String filter : filterClasses) {
filter = filter.trim();
- context.addFilter(Class.forName(filter), "/*", 0);
+ ctxHandler.addFilter(filter, PATH_SPEC_ANY, EnumSet.of(DispatcherType.REQUEST));
}
- addCSRFFilter(context, conf);
- HttpServerUtil.constrainHttpMethods(context);
+ addCSRFFilter(ctxHandler, conf);
+ HttpServerUtil.constrainHttpMethods(ctxHandler);
// Put up info server.
int port = conf.getInt("hbase.rest.info.port", 8085);
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
index b5ecb35..dfc4549 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServletContainer.java
@@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
+import org.glassfish.jersey.servlet.ServletContainer;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authorize.AuthorizationException;
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPRequestStream.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPRequestStream.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPRequestStream.java
index 02957e9..faa8eea 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPRequestStream.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPRequestStream.java
@@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.rest.filter;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
@@ -55,4 +56,19 @@ public class GZIPRequestStream extends ServletInputStream
public void close() throws IOException {
in.close();
}
+
+ @Override
+ public boolean isFinished() {
+ throw new UnsupportedOperationException("Asynchonous operation is not supported.");
+ }
+
+ @Override
+ public boolean isReady() {
+ throw new UnsupportedOperationException("Asynchonous operation is not supported.");
+ }
+
+ @Override
+ public void setReadListener(ReadListener listener) {
+ throw new UnsupportedOperationException("Asynchonous operation is not supported.");
+ }
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPResponseStream.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPResponseStream.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPResponseStream.java
index cc74f9c..0150d24 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPResponseStream.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/filter/GZIPResponseStream.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.zip.GZIPOutputStream;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletResponse;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
@@ -75,4 +76,14 @@ public class GZIPResponseStream extends ServletOutputStream
public void finish() throws IOException {
out.finish();
}
+
+ @Override
+ public boolean isReady() {
+ throw new UnsupportedOperationException("Asynchonous operation is not supported.");
+ }
+
+ @Override
+ public void setWriteListener(WriteListener writeListener) {
+ throw new UnsupportedOperationException("Asynchonous operation is not supported.");
+ }
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/ScannerModel.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/ScannerModel.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/ScannerModel.java
index d484633..5c8d618 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/ScannerModel.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/ScannerModel.java
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
+import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -78,10 +79,8 @@ import org.apache.hadoop.hbase.util.ByteStringer;
import org.apache.hadoop.hbase.util.Bytes;
import com.google.protobuf.ByteString;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.api.json.JSONJAXBContext;
-import com.sun.jersey.api.json.JSONMarshaller;
-import com.sun.jersey.api.json.JSONUnmarshaller;
+
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
/**
* A representation of Scanner parameters.
@@ -120,6 +119,14 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
private List<String> labels = new ArrayList<String>();
private boolean cacheBlocks = true;
+ /**
+ * Implement lazily-instantiated singleton as per recipe
+ * here: http://literatejava.com/jvm/fastest-threadsafe-singleton-jvm/
+ */
+ private static class JaxbJsonProviderHolder {
+ static final JacksonJaxbJsonProvider INSTANCE = new JacksonJaxbJsonProvider();
+ }
+
@XmlRootElement
static class FilterModel {
@@ -466,18 +473,27 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
}
+ // The singleton <code>JacksonJaxbJsonProvider</code> instance
+ private static JacksonJaxbJsonProvider jsonProvider;
+ private static final Object jsonProviderLock = new Object();
+
+ /**
+ * Get the <code>JacksonJaxbJsonProvider</code> instance;
+ *
+ * @return A <code>JacksonJaxbJsonProvider</code>.
+ */
+ private static JacksonJaxbJsonProvider getJasonProvider() {
+ return JaxbJsonProviderHolder.INSTANCE;
+ }
+
/**
* @param s the JSON representation of the filter
* @return the filter
* @throws Exception
*/
public static Filter buildFilter(String s) throws Exception {
- JSONJAXBContext context =
- new JSONJAXBContext(JSONConfiguration.natural().build(),
- FilterModel.class);
- JSONUnmarshaller unmarshaller = context.createJSONUnmarshaller();
- FilterModel model = unmarshaller.unmarshalFromJSON(new StringReader(s),
- FilterModel.class);
+ FilterModel model = getJasonProvider().locateMapper(FilterModel.class,
+ MediaType.APPLICATION_JSON_TYPE).readValue(s, FilterModel.class);
return model.build();
}
@@ -487,13 +503,8 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
* @throws Exception
*/
public static String stringifyFilter(final Filter filter) throws Exception {
- JSONJAXBContext context =
- new JSONJAXBContext(JSONConfiguration.natural().build(),
- FilterModel.class);
- JSONMarshaller marshaller = context.createJSONMarshaller();
- StringWriter writer = new StringWriter();
- marshaller.marshallToJSON(new FilterModel(filter), writer);
- return writer.toString();
+ return getJasonProvider().locateMapper(FilterModel.class,
+ MediaType.APPLICATION_JSON_TYPE).writeValueAsString(new FilterModel(filter));
}
private static final byte[] COLUMN_DIVIDER = Bytes.toBytes(":");
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
index ba91519..d8e8ede 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JAXBContextResolver.java
@@ -44,9 +44,6 @@ import org.apache.hadoop.hbase.rest.model.TableRegionModel;
import org.apache.hadoop.hbase.rest.model.TableSchemaModel;
import org.apache.hadoop.hbase.rest.model.VersionModel;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.api.json.JSONJAXBContext;
-
/**
* Plumbing for hooking up Jersey's JSON entity body encoding and decoding
* support to JAXB. Modify how the context is created (by using e.g. a
@@ -82,8 +79,7 @@ public class JAXBContextResolver implements ContextResolver<JAXBContext> {
@SuppressWarnings("unchecked")
public JAXBContextResolver() throws Exception {
this.types = new HashSet(Arrays.asList(cTypes));
- this.context = new JSONJAXBContext(JSONConfiguration.natural().build(),
- cTypes);
+ context = JAXBContext.newInstance(cTypes);
}
@Override
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java
deleted file mode 100644
index 7791d02..0000000
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/JacksonProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.rest.provider;
-
-import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
-
-import javax.ws.rs.ext.Provider;
-
-//create a class in the defined resource package name
-//so it gets activated
-//Use jackson to take care of json
-//since it has better support for object
-//deserializaiton and less clunky to deal with
-@Provider
-public class JacksonProvider extends JacksonJaxbJsonProvider {
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java
index fca4544..2a77683 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/PlainTextMessageBodyProducer.java
@@ -46,8 +46,6 @@ import org.apache.hadoop.hbase.rest.Constants;
public class PlainTextMessageBodyProducer
implements MessageBodyWriter<Object> {
- private ThreadLocal<byte[]> buffer = new ThreadLocal<byte[]>();
-
@Override
public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2,
MediaType arg3) {
@@ -57,9 +55,8 @@ public class PlainTextMessageBodyProducer
@Override
public long getSize(Object object, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
- byte[] bytes = object.toString().getBytes();
- buffer.set(bytes);
- return bytes.length;
+ // deprecated by JAX-RS 2.0 and ignored by Jersey runtime
+ return -1;
}
@Override
@@ -67,8 +64,6 @@ public class PlainTextMessageBodyProducer
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream outStream)
throws IOException, WebApplicationException {
- byte[] bytes = buffer.get();
- outStream.write(bytes);
- buffer.remove();
+ outStream.write(object.toString().getBytes());
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
index 12171a4..d0b1d5c 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
@@ -48,8 +48,6 @@ import org.apache.hadoop.hbase.rest.ProtobufMessageHandler;
public class ProtobufMessageBodyProducer
implements MessageBodyWriter<ProtobufMessageHandler> {
- private ThreadLocal<byte[]> buffer = new ThreadLocal<byte[]>();
-
@Override
public boolean isWriteable(Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
@@ -59,23 +57,14 @@ public class ProtobufMessageBodyProducer
@Override
public long getSize(ProtobufMessageHandler m, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try {
- baos.write(m.createProtobufOutput());
- } catch (IOException e) {
- return -1;
- }
- byte[] bytes = baos.toByteArray();
- buffer.set(bytes);
- return bytes.length;
+ // deprecated by JAX-RS 2.0 and ignored by Jersey runtime
+ return -1;
}
public void writeTo(ProtobufMessageHandler m, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException, WebApplicationException {
- byte[] bytes = buffer.get();
- entityStream.write(bytes);
- buffer.remove();
+ entityStream.write(m.createProtobufOutput());
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java
index 7c3e1fd..c5cc121 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java
@@ -25,11 +25,21 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.security.UserProvider;
import org.apache.hadoop.hbase.util.HttpServerUtil;
import org.apache.hadoop.util.StringUtils;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+
+import org.glassfish.jersey.jackson1.Jackson1Feature;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+
+import javax.servlet.DispatcherType;
+import java.util.EnumSet;
public class HBaseRESTTestingUtility {
@@ -52,37 +62,43 @@ public class HBaseRESTTestingUtility {
RESTServlet.getInstance(conf, UserProvider.instantiate(conf));
// set up the Jersey servlet container for Jetty
- ServletHolder sh = new ServletHolder(ServletContainer.class);
- sh.setInitParameter(
- "com.sun.jersey.config.property.resourceConfigClass",
- ResourceConfig.class.getCanonicalName());
- sh.setInitParameter("com.sun.jersey.config.property.packages",
- "jetty");
+ ResourceConfig app = new ResourceConfig().
+ packages("org.apache.hadoop.hbase.rest").register(Jackson1Feature.class);
+ ServletHolder sh = new ServletHolder(new ServletContainer(app));
- LOG.info("configured " + ServletContainer.class.getName());
-
// set up Jetty and run the embedded server
server = new Server(0);
- server.setSendServerVersion(false);
- server.setSendDateHeader(false);
- // set up context
- Context context = new Context(server, "/", Context.SESSIONS);
- context.addServlet(sh, "/*");
+ LOG.info("configured " + ServletContainer.class.getName());
+
+ HttpConfiguration httpConfig = new HttpConfiguration();
+ httpConfig.setSendDateHeader(false);
+ httpConfig.setSendServerVersion(false);
+ ServerConnector serverConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
+ serverConnector.setPort(testServletPort);
+
+ server.addConnector(serverConnector);
+
+ // set up context
+ ServletContextHandler ctxHandler = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
+ ctxHandler.addServlet(sh, "/*");
// Load filters specified from configuration.
String[] filterClasses = conf.getStrings(Constants.FILTER_CLASSES,
- ArrayUtils.EMPTY_STRING_ARRAY);
+ ArrayUtils.EMPTY_STRING_ARRAY);
for (String filter : filterClasses) {
filter = filter.trim();
- context.addFilter(Class.forName(filter), "/*", 0);
+ ctxHandler.addFilter(filter, "/*", EnumSet.of(DispatcherType.REQUEST));
}
- conf.set(RESTServer.REST_CSRF_BROWSER_USERAGENTS_REGEX_KEY, ".*");
- RESTServer.addCSRFFilter(context, conf);
- HttpServerUtil.constrainHttpMethods(context);
LOG.info("Loaded filter classes :" + filterClasses);
- // start the server
+
+ conf.set(RESTServer.REST_CSRF_BROWSER_USERAGENTS_REGEX_KEY, ".*");
+ RESTServer.addCSRFFilter(ctxHandler, conf);
+
+ HttpServerUtil.constrainHttpMethods(ctxHandler);
+
+ // start the server
server.start();
- // get the port
- testServletPort = server.getConnectors()[0].getLocalPort();
+ // get the port
+ testServletPort = ((ServerConnector)server.getConnectors()[0]).getLocalPort();
LOG.info("started " + server.getClass().getName() + " on port " +
testServletPort);
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java
index fc8290f..b4b00a9 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java
@@ -43,8 +43,8 @@ import org.apache.hadoop.hbase.rest.client.Response;
import org.apache.hadoop.hbase.rest.model.CellModel;
import org.apache.hadoop.hbase.rest.model.CellSetModel;
import org.apache.hadoop.hbase.rest.model.RowModel;
-import org.apache.hadoop.hbase.rest.provider.JacksonProvider;
import org.apache.hadoop.hbase.util.Bytes;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.After;
import org.junit.AfterClass;
@@ -93,7 +93,7 @@ public class RowResourceBase {
RowModel.class);
xmlMarshaller = context.createMarshaller();
xmlUnmarshaller = context.createUnmarshaller();
- jsonMapper = new JacksonProvider()
+ jsonMapper = new JacksonJaxbJsonProvider()
.locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
client = new Client(new Cluster().add("localhost",
REST_TEST_UTIL.getServletPort()));
@@ -511,7 +511,7 @@ public class RowResourceBase {
Response response = getValueJson(table, row, column);
assertEquals(response.getCode(), 200);
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
- ObjectMapper mapper = new JacksonProvider()
+ ObjectMapper mapper = new JacksonJaxbJsonProvider()
.locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class);
RowModel rowModel = cellSet.getRows().get(0);
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
index 1d245b3..9797594 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
@@ -126,21 +126,6 @@ public class TestGzipFilter {
testScannerResultCodes();
}
- @Test
- public void testErrorNotGzipped() throws Exception {
- Header[] headers = new Header[2];
- headers[0] = new BasicHeader("Accept", Constants.MIMETYPE_BINARY);
- headers[1] = new BasicHeader("Accept-Encoding", "gzip");
- Response response = client.get("/" + TABLE + "/" + ROW_1 + "/" + COLUMN_2, headers);
- assertEquals(response.getCode(), 404);
- String contentEncoding = response.getHeader("Content-Encoding");
- assertTrue(contentEncoding == null || !contentEncoding.contains("gzip"));
- response = client.get("/" + TABLE, headers);
- assertEquals(response.getCode(), 405);
- contentEncoding = response.getHeader("Content-Encoding");
- assertTrue(contentEncoding == null || !contentEncoding.contains("gzip"));
- }
-
void testScannerResultCodes() throws Exception {
Header[] headers = new Header[3];
headers[0] = new BasicHeader("Content-Type", Constants.MIMETYPE_XML);
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
index dfcc8af..2ecba6a 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
@@ -29,10 +29,10 @@ import org.apache.hadoop.hbase.rest.client.Response;
import org.apache.hadoop.hbase.rest.model.CellModel;
import org.apache.hadoop.hbase.rest.model.CellSetModel;
import org.apache.hadoop.hbase.rest.model.RowModel;
-import org.apache.hadoop.hbase.rest.provider.JacksonProvider;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RestTests;
import org.apache.hadoop.hbase.util.Bytes;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -204,7 +204,7 @@ public class TestMultiRowResource {
Response response = client.get(path.toString(), Constants.MIMETYPE_JSON);
assertEquals(response.getCode(), 200);
ObjectMapper mapper =
- new JacksonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
+ new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
CellSetModel cellSet = (CellSetModel) mapper.readValue(response.getBody(), CellSetModel.class);
assertEquals(2, cellSet.getRows().size());
assertEquals(ROW_1, Bytes.toString(cellSet.getRows().get(0).getKey()));
@@ -232,7 +232,7 @@ public class TestMultiRowResource {
client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr);
Response response = client.get(path.toString(), Constants.MIMETYPE_JSON);
assertEquals(response.getCode(), 200);
- ObjectMapper mapper = new JacksonProvider().locateMapper(CellSetModel.class,
+ ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class,
MediaType.APPLICATION_JSON_TYPE);
CellSetModel cellSet = (CellSetModel) mapper.readValue(response.getBody(), CellSetModel.class);
assertEquals(1, cellSet.getRows().size());
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java
index 7f75a22..2058f50 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestNamespacesInstanceResource.java
@@ -45,10 +45,10 @@ import org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel;
import org.apache.hadoop.hbase.rest.model.TableListModel;
import org.apache.hadoop.hbase.rest.model.TableModel;
import org.apache.hadoop.hbase.rest.model.TestNamespacesInstanceModel;
-import org.apache.hadoop.hbase.rest.provider.JacksonProvider;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RestTests;
import org.apache.hadoop.hbase.util.Bytes;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;
import static org.junit.Assert.*;
@@ -87,8 +87,8 @@ public class TestNamespacesInstanceResource {
REST_TEST_UTIL.getServletPort()));
testNamespacesInstanceModel = new TestNamespacesInstanceModel();
context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class);
- jsonMapper = new JacksonProvider()
- .locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE);
+ jsonMapper = new JacksonJaxbJsonProvider()
+ .locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE);
NAMESPACE1_PROPS.put("key1", "value1");
NAMESPACE2_PROPS.put("key2a", "value2a");
NAMESPACE2_PROPS.put("key2b", "value2b");
@@ -265,7 +265,7 @@ public class TestNamespacesInstanceResource {
// Try REST post and puts with invalid content.
response = client.post(namespacePath1, Constants.MIMETYPE_JSON, toXML(model1));
- assertEquals(500, response.getCode());
+ assertEquals(400, response.getCode());
String jsonString = jsonMapper.writeValueAsString(model2);
response = client.put(namespacePath2, Constants.MIMETYPE_XML, Bytes.toBytes(jsonString));
assertEquals(400, response.getCode());
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
index 1a86ce9..2d5a0c6 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
@@ -207,7 +207,7 @@ public class TestScannersWithLabels {
response = client.get(scannerURI, Constants.MIMETYPE_XML);
// Respond with 204 as there are no cells to be retrieved
assertEquals(response.getCode(), 204);
- assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
+ // With no content in the payload, the 'Content-Type' header is not echo back
}
@Test
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
index 32f508a..96b9c4a 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
@@ -59,13 +59,13 @@ import org.apache.hadoop.hbase.rest.client.Response;
import org.apache.hadoop.hbase.rest.model.CellModel;
import org.apache.hadoop.hbase.rest.model.CellSetModel;
import org.apache.hadoop.hbase.rest.model.RowModel;
-import org.apache.hadoop.hbase.rest.provider.JacksonProvider;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RestTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -207,7 +207,7 @@ public class TestTableScan {
Constants.MIMETYPE_JSON);
assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
- ObjectMapper mapper = new JacksonProvider()
+ ObjectMapper mapper = new JacksonJaxbJsonProvider()
.locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
CellSetModel model = mapper.readValue(response.getStream(), CellSetModel.class);
int count = TestScannerResource.countCellSet(model);
@@ -317,7 +317,7 @@ public class TestTableScan {
Constants.MIMETYPE_JSON);
assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
- ObjectMapper mapper = new JacksonProvider()
+ ObjectMapper mapper = new JacksonJaxbJsonProvider()
.locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
CellSetModel model = mapper.readValue(response.getStream(), CellSetModel.class);
int count = TestScannerResource.countCellSet(model);
@@ -460,7 +460,7 @@ public class TestTableScan {
Constants.MIMETYPE_JSON);
assertEquals(200, response.getCode());
assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
- ObjectMapper mapper = new JacksonProvider().locateMapper(CellSetModel.class,
+ ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class,
MediaType.APPLICATION_JSON_TYPE);
CellSetModel model = mapper.readValue(response.getStream(), CellSetModel.class);
int count = TestScannerResource.countCellSet(model);
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-server/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml
index 55fc256..09a4512 100644
--- a/hbase-server/pom.xml
+++ b/hbase-server/pom.xml
@@ -432,6 +432,38 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util-ajax</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jsp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson1</artifactId>
+ </dependency>
<!-- General dependencies -->
<dependency>
<groupId>com.github.stephenc.findbugs</groupId>
@@ -451,14 +483,6 @@
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- </dependency>
- <dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
@@ -487,42 +511,6 @@
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-sslengine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-2.1</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.1</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
- </dependency>
- <dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
<scope>compile</scope>
http://git-wip-us.apache.org/repos/asf/hbase/blob/ffe7dac5/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java
index 422db44c..de53bd9 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLog.java
@@ -25,8 +25,9 @@ import org.apache.commons.logging.LogConfigurationException;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Appender;
import org.apache.log4j.Logger;
-import org.mortbay.jetty.NCSARequestLog;
-import org.mortbay.jetty.RequestLog;
+
+import org.eclipse.jetty.server.RequestLog;
+import org.eclipse.jetty.server.NCSARequestLog;
/**
* RequestLog object for use with Http