[jboss-user] [JBoss Seam] - Re: Force method to be run before page redirect (no pages.xm

w17chm4n do-not-reply at jboss.com
Mon Jan 28 03:10:28 EST 2008


Using interceptor didn`t help :|


  | @Interceptor
  | public class QuestionRemovedInterceptor {
  |     
  |     @AroundInvoke
  |     public Object aroundInvoke(InvocationContext invocation) throws Exception {
  |         Contexts.removeFromAllContexts("questionCategoryList");
  |         return invocation.proceed();
  |     }
  | }
  | 


  | @Target(ElementType.TYPE)
  | @Retention(RetentionPolicy.RUNTIME)
  | @Interceptors(QuestionRemovedInterceptor.class)
  | public @interface QuestionRemoved {}
  | 

Logs look almost allright (doubled reciving questionCategoryList, but this is because the questionCategoryController is stateless)


  | 09:00:15,046 INFO  [QuestionCategoryManagerBean] Reciving QuestionCategory list
  | 09:00:15,118 INFO  [QuestionCategoryManagerBean] Reciving QuestionCategory list
  | 09:00:15,312 INFO  [QuestionManagerBean] Removing question [afgdfgsdfg]
  | 09:00:15,362 INFO  [QuestionCategoryManagerBean] Reciving QuestionCategory list
  | 09:00:15,429 INFO  [QuestionCategoryManagerBean] Reciving QuestionCategory list
  | 

I`ve also tryed to change annotation type to method


  | @Target(ElementType.METHOD)
  | @Retention(RetentionPolicy.RUNTIME)
  | @Interceptors(QuestionRemovedInterceptor.class)
  | public @interface QuestionRemoved {}
  | 

and than use it on removeQuestion


  | @QuestionRemoved
  |     public void removeQuestion(Question question) {
  |         if(question.getQuestionType().getId().equals(questionTypeManager.getQuestionTypeByName(propertiesManager.get("questiontype.input")).getId())) {
  |             questionManager.removeQuestion(question);
  |         } else {            
  |             answerManager.removeAnswers(question.getAnswers());
  |             questionManager.removeQuestion(question);
  |         }
  |     }
  | 

But that didn`t work either. Any other ideas?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123941#4123941

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123941



More information about the jboss-user mailing list