struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xnpeng <xnp...@163.com>
Subject Re:Re: How to setup Interceptor when using struts2.1.6 rest plugin with convention
Date Thu, 28 May 2009 01:40:08 GMT
Dave,
   I've tried set the config file to extends struts-default,also i've set in my packages,it
still refuse to work.

    <package name="post" 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>



在2009-05-28,"Dave Newton" <newton.dave@yahoo.com> 写道:
>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-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message