struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: Uses AbstractInterceptor instead of leaving init() and destroy() empty
Date Mon, 09 Jan 2017 09:19:08 GMT
Repository: struts
Updated Branches:
  refs/heads/master 2b12f06b0 -> a7f4e255b


Uses AbstractInterceptor instead of leaving init() and destroy() empty


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

Branch: refs/heads/master
Commit: a7f4e255b090a0e5b3742d7c492519dded4b7675
Parents: 2b12f06
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Mon Jan 9 10:18:59 2017 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Mon Jan 9 10:18:59 2017 +0100

----------------------------------------------------------------------
 .../chat/ChatAuthenticationInterceptor.java       | 10 ++--------
 .../struts2/showcase/chat/ChatInterceptor.java    | 10 ++--------
 .../opensymphony/xwork2/mock/MockInterceptor.java | 18 ++----------------
 .../interceptor/DateTextFieldInterceptor.java     | 10 ++--------
 .../struts2/rest/ContentTypeInterceptor.java      |  8 ++------
 5 files changed, 10 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/a7f4e255/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java
b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java
index b270316..fccaad7 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java
@@ -24,23 +24,17 @@ package org.apache.struts2.showcase.chat;
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
 import org.apache.struts2.dispatcher.SessionMap;
 
-public class ChatAuthenticationInterceptor implements Interceptor {
+public class ChatAuthenticationInterceptor extends AbstractInterceptor {
 
 	private static final long serialVersionUID = 1L;
 	private static final Logger LOG = LogManager.getLogger(ChatAuthenticationInterceptor.class);
 	public static final String USER_SESSION_KEY = "chatUserSessionKey";
 
-	public void destroy() {
-	}
-
-	public void init() {
-	}
-
 	public String intercept(ActionInvocation invocation) throws Exception {
 
 		LOG.debug("Authenticating chat user");

http://git-wip-us.apache.org/repos/asf/struts/blob/a7f4e255/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java
b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java
index 06a41d9..4497709 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java
@@ -23,7 +23,7 @@ package org.apache.struts2.showcase.chat;
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
 
@@ -32,7 +32,7 @@ import javax.servlet.http.HttpSession;
 /**
  * Authenticate showcase chat example, make sure everyone have a username.
  */
-public class ChatInterceptor implements Interceptor {
+public class ChatInterceptor extends AbstractInterceptor {
 
 	private static final Logger LOG = LogManager.getLogger(ChatInterceptor.class);
 
@@ -40,12 +40,6 @@ public class ChatInterceptor implements Interceptor {
 
 	public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
 
-	public void destroy() {
-	}
-
-	public void init() {
-	}
-
 	public String intercept(ActionInvocation invocation) throws Exception {
 		HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
 		User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);

http://git-wip-us.apache.org/repos/asf/struts/blob/a7f4e255/core/src/main/java/com/opensymphony/xwork2/mock/MockInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/mock/MockInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/mock/MockInterceptor.java
index 691fcf6..b648836 100644
--- a/core/src/main/java/com/opensymphony/xwork2/mock/MockInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/mock/MockInterceptor.java
@@ -16,16 +16,15 @@
 package com.opensymphony.xwork2.mock;
 
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.junit.Assert;
 
-
 /**
  * Mock for an {@link com.opensymphony.xwork2.interceptor.Interceptor}.
  *
  * @author Jason Carreira
  */
-public class MockInterceptor implements Interceptor {
+public class MockInterceptor extends AbstractInterceptor {
 
     private static final long serialVersionUID = 2692551676567227756L;
     
@@ -57,12 +56,6 @@ public class MockInterceptor implements Interceptor {
         return foo;
     }
 
-    /**
-     * Called to let an interceptor clean up any resources it has allocated.
-     */
-    public void destroy() {
-    }
-
     @Override
     public boolean equals(Object o) {
         if (this == o) {
@@ -102,13 +95,6 @@ public class MockInterceptor implements Interceptor {
     }
 
     /**
-     * Called after an Interceptor is created, but before any requests are processed using
the intercept() methodName. This
-     * gives the Interceptor a chance to initialize any needed resources.
-     */
-    public void init() {
-    }
-
-    /**
      * Allows the Interceptor to do some processing on the request before and/or after the
rest of the processing of the
      * request by the DefaultActionInvocation or to short-circuit the processing and just
return a String return code.
      */

http://git-wip-us.apache.org/repos/asf/struts/blob/a7f4e255/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
b/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
index d6a8212..a602f93 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
@@ -1,7 +1,7 @@
 package org.apache.struts2.interceptor;
 
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.dispatcher.Parameter;
@@ -12,7 +12,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.Map.Entry;
 
-public class DateTextFieldInterceptor implements Interceptor {
+public class DateTextFieldInterceptor extends AbstractInterceptor {
 
     private static final Logger LOG = LogManager.getLogger(DateTextFieldInterceptor.class);
 
@@ -56,12 +56,6 @@ public class DateTextFieldInterceptor implements Interceptor {
             return values();
         }
     }
-    
-    public void destroy() {
-    }
-
-    public void init() {
-    }
 
     public String intercept(ActionInvocation ai) throws Exception {
         HttpParameters parameters = ai.getInvocationContext().getParameters();

http://git-wip-us.apache.org/repos/asf/struts/blob/a7f4e255/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
index 7ee05a7..01340a7 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/ContentTypeInterceptor.java
@@ -24,7 +24,7 @@ package org.apache.struts2.rest;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ModelDriven;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.rest.handler.ContentTypeHandler;
 
@@ -35,7 +35,7 @@ import java.io.InputStreamReader;
 /**
  * Uses the content handler to apply the request body to the action
  */
-public class ContentTypeInterceptor implements Interceptor {
+public class ContentTypeInterceptor extends AbstractInterceptor {
 
     private static final long serialVersionUID = 1L;
     ContentTypeHandlerManager selector;
@@ -45,10 +45,6 @@ public class ContentTypeInterceptor implements Interceptor {
         this.selector = sel;
     }
     
-    public void destroy() {}
-
-    public void init() {}
-
     public String intercept(ActionInvocation invocation) throws Exception {
         HttpServletRequest request = ServletActionContext.getRequest();
         ContentTypeHandler handler = selector.getHandlerForRequest(request);


Mime
View raw message