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 b2703169a..fccaad7ce 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"); 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 06a41d969..449770925 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); 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 691fcf6a1..b6488364d 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) { @@ -101,13 +94,6 @@ public class MockInterceptor implements Interceptor { return result; } - /** - * 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. 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 d6a82126f..a602f938d 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(); 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 7ee05a715..01340a736 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);