How can you handle cross-cutting conerns in JAX-WS without Spring or AOP? Handlers?

Posted by LES2 on Stack Overflow See other posts from Stack Overflow or by LES2
Published on 2009-09-23T19:29:32Z Indexed on 2010/05/16 1:50 UTC
Read the original article Hit count: 333

Filed under:
|
|
|
|

I do have something more specific in mind, however:

Each web service method needs to be wrapped with some boiler place code (cross cutting concern, yes, spring AOP would work great here but it either doesn't work or unapproved by gov't architecture group). A simple service call is as follows:

@WebMethod...
public Foo performFoo(...) {

   Object result = null;
   Object something = blah;
   try {
      soil(something);

      result = handlePerformFoo(...);
    } catch(Exception e) {
       throw translateException(e);
    } finally {
       wash(something);
    }
    return result;
}

protected abstract Foo handlePerformFoo(...);

(I hope that's enough context). Basically, I would like a hook (that was in the same thread - like a method invocation interceptor) that could have a before() and after() that could could soil(something) and wash(something) around the method call for every freaking WebMethod.

Can't use Spring AOP because my web services are not Spring managed beans :(

HELP!!!!! Give advice! Please don't let me copy-paste that boiler plate 1 billion times (as I've been instructed to do).

Regards, LES

© Stack Overflow or respective owner

Related posts about aop

Related posts about jax-ws