aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject git commit: Upgrade jersey version.
Date Tue, 22 Jul 2014 22:59:11 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 46c9011c7 -> 04189c16a


Upgrade jersey version.

Reviewed at https://reviews.apache.org/r/23823/


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

Branch: refs/heads/master
Commit: 04189c16a80214d0f04ad74efd409b3138dca664
Parents: 46c9011
Author: Bill Farner <wfarner@apache.org>
Authored: Tue Jul 22 15:40:05 2014 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Tue Jul 22 15:51:16 2014 -0700

----------------------------------------------------------------------
 build.gradle                                    |  3 +-
 config/pmd/design.xml                           |  2 +
 .../aurora/scheduler/http/AbstractFilter.java   | 56 ++++++++++++++++++++
 .../aurora/scheduler/http/CorsFilter.java       |  3 +-
 .../aurora/scheduler/http/HttpStatsFilter.java  |  3 +-
 .../scheduler/http/LeaderRedirectFilter.java    |  3 +-
 6 files changed, 62 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/04189c16/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 009d803..df0af98 100644
--- a/build.gradle
+++ b/build.gradle
@@ -139,7 +139,7 @@ jar {
 }
 
 dependencies {
-  def jerseyRev = '1.17.1'
+  def jerseyRev = '1.18.1'
   def log4jRev = '1.2.17'
   def slf4jRev = '1.6.1'
   def junitRev = '4.11'
@@ -197,7 +197,6 @@ dependencies {
   compile 'com.twitter.common:io:0.0.53'
   compile 'com.twitter.common:jdk-logging:0.0.44'
   compile 'com.twitter.common:logging:0.0.61'
-  compile 'com.twitter.common:net-http-filters:0.0.6'
   compile 'com.twitter.common:net-util:0.0.80'
   compile 'com.twitter.common:quantity:0.0.71'
   compile 'com.twitter.common:stats:0.0.91'

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/04189c16/config/pmd/design.xml
----------------------------------------------------------------------
diff --git a/config/pmd/design.xml b/config/pmd/design.xml
index fb86e0a..2741e40 100644
--- a/config/pmd/design.xml
+++ b/config/pmd/design.xml
@@ -1545,6 +1545,7 @@ public class Foo {  //Should be final
     </rule>
 
 
+<!-- Empty methods in abstract classes can save implementers from boilerplate.
     <rule name="EmptyMethodInAbstractClassShouldBeAbstract"
    		language="java"
           since="4.1"
@@ -1593,6 +1594,7 @@ public abstract class ShouldBeAbstract {
 	     	]]>
     	</example>
     </rule>
+-->
 
     <rule name="SingularField"
           since="3.1"

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/04189c16/src/main/java/org/apache/aurora/scheduler/http/AbstractFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/AbstractFilter.java b/src/main/java/org/apache/aurora/scheduler/http/AbstractFilter.java
new file mode 100644
index 0000000..d93f6f4
--- /dev/null
+++ b/src/main/java/org/apache/aurora/scheduler/http/AbstractFilter.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed 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.aurora.scheduler.http;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A base class for a filter that expects HTTP requests. This allows filter implementations
to
+ * avoid no-op implementations and casting to HTTP request and response types.
+ */
+public abstract class AbstractFilter implements Filter {
+
+  @Override
+  public void init(FilterConfig filterConfig) throws ServletException {
+    // No-op.
+  }
+
+  @Override
+  public void doFilter(
+      ServletRequest request,
+      ServletResponse response,
+      FilterChain chain) throws IOException, ServletException {
+
+    doFilter((HttpServletRequest) request, (HttpServletResponse) response, chain);
+  }
+
+  protected abstract void doFilter(
+      HttpServletRequest request,
+      HttpServletResponse response,
+      FilterChain chain) throws IOException, ServletException;
+
+  @Override
+  public void destroy() {
+    // No-op.
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/04189c16/src/main/java/org/apache/aurora/scheduler/http/CorsFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/CorsFilter.java b/src/main/java/org/apache/aurora/scheduler/http/CorsFilter.java
index 5b2e735..e413ad9 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/CorsFilter.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/CorsFilter.java
@@ -26,13 +26,12 @@ import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.net.HttpHeaders;
 import com.twitter.common.base.MorePreconditions;
-import com.twitter.common.net.http.filters.AbstractHttpFilter;
 
 /*
  * A filter that adds CORS headers to HTTP responses. This filter enables CORS support for
a single
  * domain.
  */
-public class CorsFilter extends AbstractHttpFilter {
+public class CorsFilter extends AbstractFilter {
 
   @VisibleForTesting
   static final String ALLOWED_METHODS = Joiner.on(",")

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/04189c16/src/main/java/org/apache/aurora/scheduler/http/HttpStatsFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/HttpStatsFilter.java b/src/main/java/org/apache/aurora/scheduler/http/HttpStatsFilter.java
index f7f337f..4c2b62b 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/HttpStatsFilter.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/HttpStatsFilter.java
@@ -24,13 +24,12 @@ import javax.servlet.http.HttpServletResponseWrapper;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
-import com.twitter.common.net.http.filters.AbstractHttpFilter;
 import com.twitter.common.stats.SlidingStats;
 
 /**
  * An HTTP filter that exports counts and timing for requests based on response code.
  */
-public class HttpStatsFilter extends AbstractHttpFilter {
+public class HttpStatsFilter extends AbstractFilter {
 
   private final LoadingCache<Integer, SlidingStats> counters = CacheBuilder.newBuilder()
       .build(new CacheLoader<Integer, SlidingStats>() {

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/04189c16/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java b/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
index 86939aa..1c2b08d 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/LeaderRedirectFilter.java
@@ -23,12 +23,11 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.google.common.base.Optional;
-import com.twitter.common.net.http.filters.AbstractHttpFilter;
 
 /**
  * An HTTP filter that will redirect the request to the leading scheduler.
  */
-public class LeaderRedirectFilter extends AbstractHttpFilter {
+public class LeaderRedirectFilter extends AbstractFilter {
 
   private final LeaderRedirect redirector;
 


Mime
View raw message