Author: tschneider Date: Thu Nov 15 07:46:20 2007 New Revision: 595337 URL: http://svn.apache.org/viewvc?rev=595337&view=rev Log: Adding around interceptor for backwards compatibility
Added: struts/sandbox/trunk/struts2-webwork2-plugin/src/main/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java Added: struts/sandbox/trunk/struts2-webwork2-plugin/src/main/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-webwork2-plugin/src/main/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java?rev=595337&view=auto ============================================================================== --- struts/sandbox/trunk/struts2-webwork2-plugin/src/main/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java (added) +++ struts/sandbox/trunk/struts2-webwork2-plugin/src/main/java/com/opensymphony/xwork/interceptor/AroundInterceptor.java Thu Nov 15 07:46:20 2007 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2006 by OpenSymphony + * All rights reserved. + */ +package com.opensymphony.xwork.interceptor; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.opensymphony.xwork2.ActionInvocation; +import com.opensymphony.xwork2.interceptor.Interceptor; + + +/** + * An abstract interceptor that provides simple access to before/after callouts. + * + * @author Jason Carreira + * @deprecated AroundInterceptor was removed in Struts 2. + */ +public abstract class AroundInterceptor implements Interceptor { + + protected transient Log log = LogFactory.getLog(getClass()); + + public void destroy() { + } + + public void init() { + } + + public String intercept(ActionInvocation invocation) throws Exception { + String result = null; + + before(invocation); + result = invocation.invoke(); + after(invocation, result); + + return result; + } + + /** + * Called after the invocation has been executed. + * + * @param result the result value returned by the invocation + */ + protected abstract void after(ActionInvocation dispatcher, String result) throws Exception; + + /** + * Called before the invocation has been executed. + */ + protected abstract void before(ActionInvocation invocation) throws Exception; +} \ No newline at end of file