+1 to provide a way to register interceptor via a class-level annotation.
Is there really a need to register interceptor in a finer-level for service
methods?

I think that we need think about a better name for the annotation rather
than @Interceptor. This gives the impression that the given class itself is
a interceptor!

For ex. Jax-WS registers its service class with @WebService annotation. So,
users know that the given class denotes a web service. Further, it
registers the handler chain with annotation with @HandlerChain. [1]

[1]
http://tomee.apache.org/examples-trunk/webservice-handlerchain/README.html

Thanks,
KasunG

On Fri, Mar 11, 2016 at 2:29 PM, Afkham Azeez <[email protected]> wrote:

> It would be elegant to specify the interceptors as annotations rather than
> programatically adding them.
>
> e.g. 1
> Apply interceptors globally to all operations in a service
>
> @Path("/foo")
> @Interceptor(classes = {"org.wso2.msf4j.OAuthInterceptor",
> "org.wso2.msf4j.LogInterceptor"})
> public class FooService {
>
> }
>
> e.g.2
> Apply interceptors selectively to operations
>
> @Path("/foo")
> @Interceptor(classes = {"org.wso2.msf4j.LogInterceptor"})
> public class FooService {
>
>    @Path("secure")
>    @Interceptor(classes={"org.wso2.msf4j.OAuthInterceptor"})
>    public void secureOp(){}
>
>    @Path("unsecure")
>    public void unsecureOp{}
> }
>
> Thoughts welcome. This would simplify the programming model for users of
> MSF4J.
>
>
> --
> *Afkham Azeez*
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> * <http://www.apache.org/>*
> *email: **[email protected]* <[email protected]>
> * cell: +94 77 3320919 <%2B94%2077%203320919>blog: *
> *http://blog.afkham.org* <http://blog.afkham.org>
> *twitter: **http://twitter.com/afkham_azeez*
> <http://twitter.com/afkham_azeez>
> *linked-in: **http://lk.linkedin.com/in/afkhamazeez
> <http://lk.linkedin.com/in/afkhamazeez>*
>
> *Lean . Enterprise . Middleware*
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 

*Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
email: kasung AT spamfree wso2.com
linked-in: http://lk.linkedin.com/in/gajasinghe
blog: http://kasunbg.org
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to