You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jesper Isaksen <je...@gmail.com> on 2016/11/18 07:11:46 UTC

Accessing the SEI class from within an interceptor

Hi

When developing a server side CXF interceptor, I need to access the
Implementor class of a JAX-WS service to retrieve configuration values. Is
it possible to access the implementor class from within a custom
interceptor without using reflection?

My current solution is can be seen in the code below but I would prefer a
cleaner solution if possible:

Endpoint endpoint = message.getExchange().getEndpoint();
if(endpoint instanceof JaxWsEndpointImpl) {
JaxWsEndpointImpl endpointImpl = (JaxWsEndpointImpl) endpoint;<
JaxWsImplementorInfo implInfo;
try {
Field implementorInfo =
endpointImpl.getClass().getDeclaredField("implInfo");
implementorInfo.setAccessible(true);
implInfo = (JaxWsImplementorInfo) implementorInfo.get(endpointImpl);
Class<?> implementorClass = implInfo.getImplementorClass();
} catch (IllegalAccessException | NoSuchFieldException e) {
e.printStackTrace();
}
}

I am using CXF 2.6.8. And thanks for a great framework!

Best regards
Jesper