jsr342-experts@javaee-spec.java.net

[jsr342-experts] Interceptors in JAX-WS

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Mon, 29 Oct 2012 18:03:57 +0100

Hi all,

One difference between Servlet and EJB endpoint in JAX-WS is that EJB's can
use interceptors (and with CDI, interceptor binding) :

@WebService
*_at_Stateless*
public class CardValidator {

  *_at_LoggableInterceptor*
  public boolean validate(CreditCard creditCard) {
  }
}


Which is not possible with just Servlet endpoint

@WebService
public class CardValidator {

  *_at_InterceptorDoesNotWork*
  public boolean validate(CreditCard creditCard) {
  }
}

If we spread CDI and Managed Beans all over, I would think that Servlet
endpoint are managed beans, therefore interceptors would work... as well as
transactions :

@WebService
*_at_Transactional*
public class CardValidator {

  *_at_InterceptorShouldWork*
  public boolean validate(CreditCard creditCard) {
  }
}


What you all think ?


-- 
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org> |
Twitter<http://twitter.com/agoncal>|
LinkedIn <http://www.linkedin.com/in/agoncal> | Paris
JUG<http://www.parisjug.org> |
Devoxx France <http://www.devoxx.fr>