cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesper Isaksen <jesper...@gmail.com>
Subject Accessing the SEI class from within an interceptor
Date Fri, 18 Nov 2016 07:11:46 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message