Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ protected void doInit() throws Exception {
super.doInit();

// camel-rest is optional
if (getEndpoint().getCamelContext().getCamelContextExtension().isContextPluginInUse(RestRegistry.class)) {
restRegistry = PluginHelper.getRestRegistry(getEndpoint().getCamelContext());
}
restRegistry = PluginHelper.getRestRegistry(getEndpoint().getCamelContext());

methods = Method.parseList(getEndpoint().getHttpMethodRestrict());
path = configureEndpointPath(getEndpoint()); // in vertx-web we should replace path parameters from {xxx} to :xxx syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ public MultiRestConsumer(CamelContext context, RestConsumerFactory factory, Endp
null, null, null, config, Collections.emptyMap());
configurer.configure(consumer);

if (context.getCamelContextExtension().isContextPluginInUse(RestRegistry.class)) {
PluginHelper.getRestRegistry(context).addRestService(consumer, false, url, url, path, null, method,
RestRegistry rr = PluginHelper.getRestRegistry(context);
if (rr != null) {
rr.addRestService(consumer, false, url, url, path, null, method,
null, null, null, null, null, null, null, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4348,6 +4348,9 @@ public void setRestRegistry(RestRegistry restRegistry) {

protected RestRegistry createRestRegistry() {
RestRegistryFactory factory = camelContextExtension.getRestRegistryFactory();
if (factory == null) {
return null;
}
return factory.createRegistry();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,10 @@ RestRegistryFactory getRestRegistryFactory() {
lock.lock();
try {
if (restRegistryFactory == null) {
setRestRegistryFactory(camelContext.createRestRegistryFactory());
RestRegistryFactory factory = camelContext.createRestRegistryFactory();
if (factory != null) {
setRestRegistryFactory(factory);
}
}
} finally {
lock.unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public <T> T getContextPlugin(Class<T> type) {
}
if (extension instanceof Supplier supplier) {
extension = supplier.get();
addContextPlugin(type, (T) extension);
if (extension != null) {
addContextPlugin(type, (T) extension);
} else {
extensions.remove(type);
}
}
return (T) extension;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,10 @@ protected UriFactoryResolver createUriFactoryResolver() {

@Override
protected RestRegistryFactory createRestRegistryFactory() {
return ResolverHelper.resolveMandatoryBootstrapService(getCamelContextReference(),
return ResolverHelper.resolveBootstrapService(getCamelContextReference(),
RestRegistryFactory.FACTORY,
RestRegistryFactory.class,
"camel-rest");
RestRegistryFactory.class)
.orElse(null);
}

@Override
Expand Down