1

storeインターセプターを使用しています。ごくまれに、このインターセプターがSession Already Invalidate 例外をスローし、エラー メッセージをセッションに入れようとすることがあります (MessageStoreInterceptor行: 282)。

このインターセプターをオーバーライドして、黙って例外を浅くし、アクションを実行させようとしました。

単純に思えますが、例外が発生したときに何を返す必要があるのか​​ わかりません(次のインターセプターを取得するにはどうすればよいですか?!):

public class MyMessageStoreInterceptor extends MessageStoreInterceptor {

    @Override
    public String intercept(ActionInvocation invocation) throws Exception {

        try{
            return super.intercept(invocation);
        }catch(IllegalStateException ex){
            return ??; 
        }

    }    
}
4

1 に答える 1

2

次のインターセプターに到達したい場合は、 を返す必要がありますinvocation.invoke()。アクションの結果を返します。例外が原因で結果を取得できず、アクションの呼び出しを続行したい場合は、独自の結果または や などの事前定義された結果の 1 つを返す必要がありSUCCESSますERROR

@Override
public String intercept(ActionInvocation invocation) throws Exception {

    try{
        return super.intercept(invocation);
    }catch(IllegalStateException ex){
        return Action.ERROR; 
    }

}    
于 2016-01-30T09:33:59.623 に答える