use of org.qi4j.library.rest.server.spi.RequestReader in project qi4j-sdk by Qi4j.
the class RequestReaderDelegator method init.
public void init(@Service Iterable<ServiceReference<RequestReader>> requestReaderReferences) throws InitializationException {
Logger logger = LoggerFactory.getLogger(getClass());
// Add custom readers first
for (ServiceReference<RequestReader> requestReader : requestReaderReferences) {
if (!requestReader.identity().equals("requestreaderdelegator")) {
logger.info("Registered request reader:" + requestReader.identity());
registerRequestReader(requestReader.get());
}
}
// Add defaults
ResourceBundle defaultRequestReaders = ResourceBundle.getBundle("org.qi4j.library.rest.server.rest-server");
String requestReaderClasses = defaultRequestReaders.getString("requestreaders");
logger.info("Using request readers:" + requestReaderClasses);
for (String className : requestReaderClasses.split(",")) {
try {
Class readerClass = module.classLoader().loadClass(className.trim());
RequestReader writer = (RequestReader) module.newObject(readerClass);
registerRequestReader(writer);
} catch (ClassNotFoundException e) {
logger.warn("Could not register request reader " + className, e);
}
}
}
Aggregations