This content has been marked as final.
Show 3 replies
-
1. Re: Conversation demarcation
nickarls Jun 3, 2009 7:55 AM (in response to gonorrhea)Those are convenience stuff that should be handled by frameworks built on top of 299.
-
2. Re: Conversation demarcation
musketyr Jun 23, 2009 5:39 PM (in response to gonorrhea)I think this could by well done by two simple interceptors:
@InterceptorBindingType
@Target({METHOD, TYPE})
@Retention(RUNTIME)
public @interface ConversationBegin {
@NonBinding String id() default "";
@NonBinging long timeout() default 0;
}
@ConversationBegin @Interceptor ConverstaionBeginInterceptor {
@Current Conversation conversation;
@AroundInvoke public Object conversationBegin(InvocationContext ctx){
ConversationBegin begin = ctx.getMethod().getAnnotation(ConversationBegin.class);
if("".equals(begin.id()){
conversation.begin(begin.id());
} else {
conversation.begin();
}
if(begin.timeout() != 0){
conversation.setTimeout(begin.timeout());
}
ctx.proceed();
}
}
@InterceptorBindingType
@Target({METHOD, TYPE})
@Retention(RUNTIME)
public @interface ConversationEnd {}
@ConversationEnd @Interceptor ConverstaionEndInterceptor {
@Current Conversation conversation;
@AroundInvoke public Object conversationEnd(InvocationContext ctx){
ctx.proceed();
conversation.end();
}
}
It would be fine to have this interceptors built in web beans standard.
It would be also fine to have some way how to have interceptors enabled by default. e.g. autoenable property of InterceptorBindingType but it could break the interceptor contract with container :( -
3. Re: Conversation demarcation
musketyr Jun 23, 2009 7:34 PM (in response to gonorrhea)I've missed returning ctx.proceed() value :(
sorry