On Mar 1, 2008, at 5:36 PM, wesley wrote:

> Hi Scott,
>
>    I've upgraded my 3.1..s080202 snapshot to release 3.1.5 today,  
> and found
> my intercepted components broken.
>    After some examinations, I think the problem should be the runtime
> weaver who was responsible to generate code for webbeans component  
> annotated
> to be intercepted.

Thanks for all the details, I've filed it as 
http://bugs.caucho.com/view.php?id=2483

The interception code was rewritten for 3.1.5 to merge with the EJB  
code.  The new method is more sensitive to exceptions (the old one  
basically ignored them)

-- Scott

>
>    The attachment is an IntelliJ IDEA project which contains a trivial
> servlet calling a injected service to output "hello" to html out.  
> There're
> four classes below:
>
> ================the binding type, no problem============
> package com.mycompany.interceptors;
>
> import javax.webbeans.InterceptorBindingType;
> import java.lang.annotation.*;
>
> @InterceptorBindingType
> @Target({ElementType.METHOD, ElementType.TYPE})
> @Retention(RetentionPolicy.RUNTIME)
> public @interface Cachable {
> }
> ===============================================
>
> ================the interceptor, no problem============
> package com.mycompany.interceptors;
>
> import javax.interceptor.AroundInvoke;
> import javax.interceptor.InvocationContext;
> import javax.webbeans.Interceptor;
>
> @Cachable
> @Interceptor
> public class CacheInterceptor {
>
> public CacheInterceptor() {
> }
>
> @AroundInvoke
> public Object invoke(final InvocationContext invocation) throws  
> Throwable {
>  System.out.println("intercepted");
>  return invocation.proceed();
> }
>
> }
> ===============================================
>
>
> ================the servlet, no problem================
> package com.mycompany.servlet;
>
> import com.mycompany.services.TestService;
>
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.ServletException;
> import javax.webbeans.In;
> import java.io.IOException;
>
> public class MyServlet extends HttpServlet {
> @In
> TestService service;
> protected void doGet(HttpServletRequest request, HttpServletResponse
> response)
>   throws ServletException, IOException {
>  try {
>   response.getOutputStream().print(service.service());
>  } catch (Exception e) {
>   throw new ServletException(e);
>  }
> }
> }
> ===============================================
>
>
> ================the service component, BUG!!!!!==========
> package com.mycompany.services;
>
> import com.mycompany.interceptors.Cachable;
>
> import javax.webbeans.Component;
>
> @Component
> public class TestService {
> public TestService() {
> }
>
> @Cachable
> public String service() throws Exception { // todo bug: if not throws
> Exception, everything is ok
>  return "hello";
> }
> }
> ===============================================
> Note the TODO in the service component code.
>
> Sorry I sent an incomplete mail a minute ago.
>
> Regards,
>
> -Wesley
>
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to