Hi,musachy! things are going on. when i add a line to my Controller(Action): @InterceptorRefs({...@interceptorref("user"), @InterceptorRef("defaultStack")}) public class MainController extends MainAction {...} then some error happens: Caused by: Unable to find interceptor class referenced by ref-name user - [unknown location]
again,the following is my config file. <struts> <constant name="struts.i18n.encoding" value="UTF-8"/> <constant name="struts.devMode" value="false"/> <constant name="struts.enable.DynamicMethodInvocation" value="false"/> <constant name="struts.custom.i18n.resources" value="default"/> <constant name="struts.serve.static.browserCache" value="true"/> <constant name="struts.convention.action.suffix" value="Controller"/> <constant name="struts.convention.action.mapAllMatches" value="true"/> <constant name="struts.convention.default.parent.package" value="rest-default"/> <constant name="struts.convention.package.locators" value="rest"/> <constant name="struts.convention.result.path" value="/WEB-INF/content"/> <constant name="struts.multipart.saveDir" value="Z:\apacheroot\uploads"/> <constant name="struts.multipart.maxSize" value="1024000"/> <package name="default" namespace="/" extends="struts-default"> <interceptors> <interceptor name="authentication" class="com.xunan.framework.web.interceptor.SimpleInterceptor"/> <interceptor-stack name="user"> <interceptor-ref name="authentication"/> <interceptor-ref name="defaultStack"/> </interceptor-stack> <interceptor-stack name="user-submit"> <interceptor-ref name="tokenSession"/> <interceptor-ref name="user"/> </interceptor-stack> <interceptor-stack name="guest"> <interceptor-ref name="defaultStack"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="user"/> <global-results> <result name="error" type="freemarker">/error.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="error"> </exception-mapping> </global-exception-mappings> </package> <package name="main" namespace="/post" extends="default"> <interceptors> <interceptor name="authentication" class="com.xunan.framework.web.interceptor.SimpleInterceptor"/> <interceptor-stack name="user"> <interceptor-ref name="authentication"/> <interceptor-ref name="defaultStack"/> </interceptor-stack> <interceptor-stack name="user-submit"> <interceptor-ref name="tokenSession"/> <interceptor-ref name="user"/> </interceptor-stack> <interceptor-stack name="guest"> <interceptor-ref name="defaultStack"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="user"/> </package> <package name="admin" namespace="/admin" extends="default"> <default-interceptor-ref name="user"/> </package> </struts> 在2009-05-28,"Musachy Barroso" <musa...@gmail.com> 写道: >that setting is telling Convention to use that package for the actions >it will create, and its default interceptor stack will be applied to >those actions. You need to make it point to your own package, which >defines a default interceptor stack with your interceptor. Either >that, or use @InterceptorRef in your actions. > >musachy > >2009/5/27 xnpeng <xnp...@163.com>: >> hi,Musachy : >> I have a line defined in config file: >> <constant name="struts.convention.default.parent.package" >> value="rest-default"/> >> do you mean change to otherwise? >> >> >> >> >> 在2009-05-28,"Musachy Barroso" <musa...@gmail.com> 写道: >>>also, change this: >>> >>><constant name="struts.convention.default.parent.package" >>>value="rest-default"/> >>> >>>and make it point to your interceptor stack, otherwise your >>>interceptor won't be used, unless you use the @InterceptorRef >>>annotation. >>> >>>musachy >>> >>>On Wed, May 27, 2009 at 9:31 PM, Dave Newton <newton.d...@yahoo.com> wrote: >>>> You're setting the default parent package to rest-default, which doesn't >>>> include your interceptor--have you tried setting it to the package with >>>> your interceptor in it? >>>> >>>> Dave >>>> >>>> xnpeng wrote: >>>>> >>>>> Hi, when i use rest-plugin with convention plugin in struts2.1.6, i >>>>> cannot setup my interceptor. the following is my interceptor and >>>>> config file. i cannot see the println result on console. can anyone >>>>> help? thank you! >>>>> >>>>> public class SimpleInterceptor extends AbstractInterceptor { public >>>>> String intercept(ActionInvocation invocation) throws Exception { >>>>> System.out.println("!!!!!SimpleInterceptor==date:" + (new Date())); return >>>>> invocation.invoke(); } } >>>>> >>>>> <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache >>>>> Software Foundation//DTD Struts Configuration 2.1//EN" >>>>> "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <constant >>>>> name="struts.i18n.encoding" value="UTF-8"/> <constant >>>>> name="struts.devMode" value="false"/> <constant >>>>> name="struts.enable.DynamicMethodInvocation" value="false"/> <constant >>>>> name="struts.custom.i18n.resources" value="default"/> <constant >>>>> name="struts.serve.static.browserCache" value="true"/> <constant >>>>> name="struts.convention.action.suffix" value="Controller"/> >>>>> ?<constant name="struts.convention.action.mapAllMatches" >>>>> value="true"/> <constant >>>>> name="struts.convention.default.parent.package" >>>>> value="rest-default"/> <constant >>>>> name="struts.convention.package.locators" value="rest"/> <constant >>>>> name="struts.convention.result.path" value="/WEB-INF/content"/> <constant >>>>> name="struts.multipart.saveDir" >>>>> value="Z:\apacheroot\uploads"/> <constant >>>>> name="struts.multipart.maxSize" value="1024000"/> <package >>>>> name="default" namespace="/" extends="rest-default"> <interceptors> >>>>> <interceptor name="authentication" >>>>> class="com.xunan.framework.web.interceptor.SimpleInterceptor"/> >>>>> <interceptor-stack name="user"> <interceptor-ref >>>>> name="authentication"/> <interceptor-ref name="defaultStack"/> >>>>> </interceptor-stack> <interceptor-stack name="user-submit"> >>>>> <interceptor-ref >>>>> name="tokenSession"/> <interceptor-ref name="user"/> >>>>> ?</interceptor-stack> <interceptor-stack name="guest"> <interceptor-ref >>>>> name="defaultStack"/> </interceptor-stack> </interceptors> >>>>> <default-interceptor-ref name="user"/> <global-results> <result >>>>> name="error" >>>>> type="freemarker">/error.jsp</result> </global-results> >>>>> <global-exception-mappings> <exception-mapping >>>>> exception="java.lang.Exception" result="error"> </exception-mapping> >>>>> </global-exception-mappings> </package> <package name="main" >>>>> namespace="/post" extends="default"> <default-interceptor-ref >>>>> name="user"/> </package> >>>>> >>>>> <package name="admin" namespace="/admin" extends="default"> >>>>> <default-interceptor-ref name="user"/> </package> </struts> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>> For additional commands, e-mail: user-h...@struts.apache.org >>>> >>>> >>> >>> >>> >>>-- >>>"Hey you! Would you help me to carry the stone?" Pink Floyd >>> >>>--------------------------------------------------------------------- >>>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>For additional commands, e-mail: user-h...@struts.apache.org >>> >> > > > >-- >"Hey you! Would you help me to carry the stone?" Pink Floyd > >--------------------------------------------------------------------- >To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >For additional commands, e-mail: user-h...@struts.apache.org >