- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在将 AEM 6.1 应用程序迁移到 AEM 6.3。由于 Felix 注释 (org.apache.felix.scr.annotations.*) 已被弃用,我决定将我的组件迁移到 OSGi 注释 (org.osgi.service.component.annotations.*)。
一旦我弄清楚了它是如何工作的,就非常简单了。但有一种情况我不知道如何处理:带有 propertyPriavte = true 的属性。
旧的实现如下所示:
@Component(metatype = true)
@Service(Servlet.class)
@Properties({
@Property(name = "sling.servlet.selectors", value = "overlay", propertyPrivate = true),
})
public class OverlayServletImpl extends OverlayServlet {
...
}
属性sling.servlet.selectors在AEM控制台的配置管理器中不可配置,但由于配置文件的原因它可以配置,对吗?所以,我仍然需要定义这个属性。
对于其他属性,我改变了我的实现,如下所示:
// OverlayServletImpl
@Component(
service = Servlet.class,
configurationPid = "my.package.path.OverlayServletImpl"
)
@Designate(
ocd = OverlayServletImplConfiguration.class
)
public class OverlayServletImpl extends OverlayServlet {
...
}
// Configuration
@ObjectClassDefinition(name = "Overlay Servlet")
public @interface OverlayServletImplConfiguration {
String sling_servlet_selectors() default "overlay";
...
}
现在,我有了属性sling.servlet.selectors,但它也可以在配置管理器中使用,并且可以在其中更改它的值。但我不想这样。
我怎样才能做到这一点?这可以通过 OSGi 注释实现吗?
谢谢您并致以最诚挚的问候!
最佳答案
如果您使用 @Component
注释来指定您的私有(private)属性,这似乎是可能的。
@Component(service = Servlet.class,
property =
{ SLING_SERVLET_RESOURCE_TYPES + "=aemhtlexamples/structure/page",
SLING_SERVLET_METHODS + "=GET",
SLING_SERVLET_EXTENSIONS + "=html",
SLING_SERVLET_SELECTORS + "=hello" })
public class SimpleServlet extends SlingSafeMethodsServlet {
@Override
protected void doGet(final SlingHttpServletRequest req, final SlingHttpServletResponse resp)
throws ServletException, IOException {
final Resource resource = req.getResource();
resp.getOutputStream().println(resource.toString());
resp.getOutputStream().println("This content is generated by the SimpleServlet");
}
}
关于spring - AEM 6.3 - 将 Felix 迁移到 OSGi 注释 : How to deal with propertyPrivate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45509554/
我在 trying to share the Struts packages 时遇到了这个问题在 OSGi 容器内的多个包之间。我想避免在包内重复依赖项并在它们之间引入新的依赖项(通过让一个包导出其内
我正在考虑在我们的项目中管理版本控制的最佳方式。目前,我们 bundle 中的每个包都是导出的(这将在以后改进,所以不要因为这个失礼而挂断电话)。我们正在使用 maven-bundle-plugin,
我正在进行一个项目,我们将迁移基于大量定制技术的主要软件系统,使其基于 OSGi 服务。为此,我们可能需要某种与 OSGi 服务配合良好的消息总线。 同步和异步传送 仅点对点 保证交付 - 最好通过文
我的项目有一组自定义定义的注释,它们可以出现在 OSGi 4.3 框架中部署的任何包中。我想在类路径中找到任何带有这些注释的类。我尝试使用 BundleWiring.listResources(...
我创建了一个片段包来访问一些添加到第二方 jar 的功能。我的片段应该注册一个服务来公开这个新功能。它似乎不起作用。在我深入进行故障排除之前,我想知道这是否被允许?也就是说,Felix SCR 的 b
OSGi 是 Java 的动态模块化系统。好的,但是基线主题是什么,为什么要开发 OSGi?使用 OSGi 有什么好处?开发 OSGi 的主要故事是什么?它为什么存在? 最佳答案 如果你仔细观察,Ja
当一个包被更新(比如修复一个错误)时,当前正在使用正在更新的包的其他包会发生什么? 假设有两个捆绑包 service 和 dao。假设当我发出更新 dao 层的命令时,服务包中的类正在使用 dao 包
在 OSGi 下,组件与服务之间的主要区别是什么?据我了解,所有服务都必须是组件,但并非所有组件都必须是服务。 在示例用例中使用其中一种比另一种有什么好处? 最佳答案 “组件”的定义不如服务正式。 服
这合法吗?org.fragment1 的 MANIFEST.MF(org.host 是普通包,不是片段): Bundle-SymbolicName: org.fragment1 Fragment-Ho
在我当前的应用程序中,我在几个地方遇到了这种模式:我在一个 bundle 中有两个服务接口(interface),它们执行不同但相关的工作。 interface Service1 { ... } in
我的 OSGi 应用程序需要一个 jar(sample;version=A),并且我必须将相同的 jar(sample;version=B) 用于我开发的新包。 示例 jar 有一些增强功能,因此我不
osgi> install file:D:\f1\*.jar osgi> install --start file:D:\f1\*.jar 以上命令在 WSO2 OSGi 控制台中是非法的。如何从文件
和有什么不一样和 在spring DM的xml配置文件中。 最佳答案 可用于获取 对现有 OSGi 服务的引用,以便您的 bean 可以使用它。 可用于导出将 bean 作为 OSGi 服务,以
我有一个应用程序暂时使用 Equinox 作为 osgi 框架。直到现在我都使用系统属性 osgi.install.area 来指定我的包在哪里 ${osgi.install.area}/ plu
背景 在过去一年左右的时间里,我设计了许多工具,旨在帮助我为 XPage 编程。这些工具主要包括帮助程序 java 类、扩展日志记录(使用 OpenLogger 和我自己的东西),以及我个人觉得我不能
我有一个 OSGi 组件 MyComponent . 该组件引用了服务 MyService .现在MyService有几个实现 MyServiceImpl1和 MyServiceImpl2 . MyC
我有几个 OSGi 包,每个都可以从 OSGi 包存储库更新。 当我启动我的 OSGi 框架 (Apache Felix) 时,我希望第一个包启动并检查所有已安装包的更新。如果有可用更新,它应该更新每
当我们在 Apache Felix Web OSGi 控制台的配置选项卡中更新组件的任何配置时,这些配置设置保存在哪里?这是针对 AEM 6.0 或更高版本。 最佳答案 手动保存的配置设置存储在 cr
我有简单的 OSGI 事件监听器类 @Component(immediate = true) @Service(value = { EventHandler.class, JobConsumer.cl
我们正在开发一个网络应用程序(我们称之为图像库),我们已经确定了以下需求: 该应用程序迎合由一组用户组成的客户。 可以动态创建新客户并由客户管理其用户 客户有不同的功能集,可以动态更改 客户可以开发自
我是一名优秀的程序员,十分优秀!