Hi Dave!
   I'm using Struts2.1.6 and struts2-rest-plugin-2.1.6.

first ,I need a global error page when exception happen like this:

Stacktraces
java.lang.NoSuchMethodException: com.xunan.sitexa.rest.MainController.a() 
    java.lang.Class.getMethod(Unknown Source)
    
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)
    
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
    
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
    
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
    
org.apache.struts2.rest.ContentTypeInterceptor.intercept(ContentTypeInterceptor.java:67)
    
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)

and second,I want to forward request to  action like the follow:
if(type=='1'){
    request.forward("action1);
}else if(type=='2'){
    request.forward("action1);
}

third, a SimpleInterceptor doing login check,
 <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>

thank you very much.


在2009-05-20,"Dave Newton" <newton.d...@yahoo.com> 写道:
>xnpeng wrote:
>> I'm doing my project with struts2+rest-plugin for about 3 months.there is a 
>> lot of problems unresolved.
>>  
>> With rest-plugin and convention-plugin,all action-mapping are done 
>> automatically,manual action-mapping in struts.xml cannot work.so,
>> 1, I cannot define global-error-result;
>> 2, I cannot do forward;
>> 3, I cannot insert my own Interceptors.
>> 
>> I 'm watching this mail-list day and day, there is not much discuss on 
>> rest-plugin, neithere is enough materials on the internet. Does someone have 
>> much experience on this topic? I need your help ergently!
>>  
>> 
>>  
>
>It's definitely possible to combine REST and XML mappings.
>
>You might have better luck telling us what specific issues you're 
>having, along with what version of S2 you're using.
>
>Dave
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>

Reply via email to