关闭 Apache Aries 的默认网页

Shut the default web page of Apache Aries down

我在 karaf 中使用 Apache Aries。我在一个单独的包中设置了我的主页。问题是当我停止我的 'web-home' 包时,我看到了 apache aries 默认页面。

在 karaf-logs 中我看到默认页面总是被调用。

"WARN JAXRSUtils  - Both org.apache.aries.jax.rs.whiteboard.internal.DefaultWeb#home and my.packet.Home#home are equal candidates for handling the current request which can lead to unpredictable results"

这是我的 Home.java 的样子:

@Path("/")
@Component(
    property = {
        JaxrsWhiteboardConstants.JAX_RS_APPLICATION_SELECT + "=(osgi.jaxrs.name=.default)",
        JaxrsWhiteboardConstants.JAX_RS_RESOURCE + "=true"
    },
    service = Home.class
)
public class Home {...

那么,如何配置白羊座以关闭其主页,或者以其他方式防止这种潜在的不可预测的结果?

如果有人问我,我很乐意澄清更多必要的细节。提前致谢。

看起来 DefaultWeb 是由一个名为 default.web 的配置创建的 WhiteBoard class 就在这里:

return OSGi.register(
            Application.class,
            () -> new DefaultApplication() {

                @Override
                public Set<Object> getSingletons() {
                    Object defaultApplication = _configurationMap.get(
                        "default.web");

                    if (defaultApplication == null ||
                        Boolean.parseBoolean(defaultApplication.toString())) {

                        return Collections.singleton(new DefaultWeb());
                    }
                    else {
                        return Collections.emptySet();
                    }
                }

            },

查看 bundle activator 看起来,如果您将配置 default.web 设置为 false,它将禁用默认页面。

为此,创建或查找此文件:

.../etc/org.apache.aries.jax.rs.whiteboard.default.cfg

(这是这个包的默认配置文件。一般来说,默认配置文件是:../etc/<Persistent ID of Bundel.cfg) 并添加/设置此行:

default.web=false