use of jakarta.jws.HandlerChain in project metro-jax-ws by eclipse-ee4j.
the class HandlerAnnotationProcessor method buildHandlerChainsModel.
public static HandlerChainsModel buildHandlerChainsModel(final Class<?> clazz) {
if (clazz == null) {
return null;
}
HandlerChain handlerChain = clazz.getAnnotation(HandlerChain.class);
if (handlerChain == null)
return null;
InputStream iStream = getFileAsStream(clazz, handlerChain);
XMLStreamReader reader = XMLStreamReaderFactory.create(null, iStream, true);
XMLStreamReaderUtil.nextElementContent(reader);
HandlerChainsModel handlerChainsModel = HandlerChainsModel.parseHandlerConfigFile(clazz, reader);
try {
reader.close();
iStream.close();
} catch (XMLStreamException | IOException e) {
e.printStackTrace();
throw new UtilException(e.getMessage());
}
return handlerChainsModel;
}
use of jakarta.jws.HandlerChain in project metro-jax-ws by eclipse-ee4j.
the class HandlerAnnotationProcessor method buildHandlerInfo.
/**
* <p>This method is called by
* {@link EndpointFactory} when
* they have an annotated class.
*
* <p>If there is no handler chain annotation on the class,
* this method will return null. Otherwise it will load the
* class and call the parseHandlerFile method to read the
* information.
*
* @return A HandlerAnnotationInfo object that stores the
* handlers and roles. Will return null if the class passed
* in has no handler chain annotation.
*/
public static HandlerAnnotationInfo buildHandlerInfo(@NotNull Class<?> clazz, QName serviceName, QName portName, WSBinding binding) {
MetadataReader metadataReader = EndpointFactory.getExternalMetadatReader(clazz, binding);
if (metadataReader == null) {
metadataReader = new ReflectAnnotationReader();
}
// clazz = checkClass(clazz);
HandlerChain handlerChain = metadataReader.getAnnotation(HandlerChain.class, clazz);
if (handlerChain == null) {
clazz = getSEI(clazz, metadataReader);
if (clazz != null)
handlerChain = metadataReader.getAnnotation(HandlerChain.class, clazz);
if (handlerChain == null)
return null;
}
if (clazz.getAnnotation(SOAPMessageHandlers.class) != null) {
throw new UtilException("util.handler.cannot.combine.soapmessagehandlers");
}
InputStream iStream = getFileAsStream(clazz, handlerChain);
XMLStreamReader reader = XMLStreamReaderFactory.create(null, iStream, true);
XMLStreamReaderUtil.nextElementContent(reader);
HandlerAnnotationInfo handlerAnnInfo = HandlerChainsModel.parseHandlerFile(reader, clazz.getClassLoader(), serviceName, portName, binding);
try {
reader.close();
iStream.close();
} catch (XMLStreamException | IOException e) {
e.printStackTrace();
throw new UtilException(e.getMessage());
}
return handlerAnnInfo;
}
Aggregations