我正在使用Day CQ.我想使用Felix控制台中提供的连接池将一些数据存储在SQL Server数据库中.我可以通过使用在defineObjects标记中定义的SlingScriptHelper类型的"sling"对象从JSP执行此操作
sling.getService(DataSourcePool.class).
Run Code Online (Sandbox Code Playgroud)
但是,我想使用在OSGi包中创建的servlet来处理来自客户端的请求.servlet没有defineObjects标记,因此未定义"sling"对象.我没有看到在servlet中创建有效的SlingScriptHelper对象的方法,但似乎必须可行.
有办法吗?
我在如何为选择对话框添加选项方面遇到了困难.
我正在阅读的Adobe笔记在这里:CQ.form.Selection
向下滚动options : Object[]/String将显示两种方法来引用选项,通过对象或字符串提供所述选择.我正在尝试使用对象方法.他们提供的格式示例就足够了.
[
{
value: "pink", // all types except "combobox"
text: "Pink",
qtip: "Real Pink" // "select" and "combobox"
}
]
Run Code Online (Sandbox Code Playgroud)
但是,CRXDE Lite不允许我在添加新属性时选择或键入Object,这是我不知所措的地方.还有另一种输入复杂价值的方法吗?
我使用CQ5原型创建了一个新的Maven项目,并将其导入IntelliJ IDEA.IntelliJ标记某些类的用法,例如org.apache.felix.annotations.Component,org.apache.felix.annotations.ReferenceIntellIJ与以下错误消息一样错误:
The package is not exported by the bundle dependencies
Run Code Online (Sandbox Code Playgroud)

我对跟进事情感到有点困惑.我理解@Service和@Component注释是我们在OSGi中定义组件或服务时的主要注释.我指的是http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.html以及OSGi组件和服务之间有什么区别
问题:
没有@Component注释就无法创建服务,为什么会这样?
我理解,一旦我们定义了一个服务,它的生命周期就会被OSGi管理得不同,但这样做有什么好处?
我们如何使用定义为@Component的类作为服务可以通过访问 sling.getService(ServiceName.class)
我们如何检查Adobe Experience Manager/CQ5中的html页面是以触摸模式还是经典模式打开?
我目前正在开发一个使用Vite 4.3.2 版本的项目,并通过aem-vite插件与 Adobe Experience Manager (AEM)集成。该项目还包括“@aem-vite/vite-aem-plugin”和“@aem-vite/import-rewriter”。
我面临的问题是该项目在开发服务器上运行良好,但在为生产构建时抛出错误。我在浏览器控制台中收到的错误消息是:
模块“”已外部化以实现浏览器兼容性。无法访问客户端代码中的“.custom”。
模块“”部分没有明确说明可能导致此问题的实际模块。
这是我的整个 vite.config.ts 文件:
export default defineConfig(({ command, mode }) => ({
plugins: [
vue(),
vueJsx(),
tsconfigPaths(),
viteForAem({
contentPaths: [designsName, 'content'],
publicPath: clientLibsPath,
}),
bundlesImportRewriter({
publicPath: clientLibsPath,
resourcesPath: 'resources/js',
}),
commonjs({
include: '/node_modules/',
requireReturnsDefault: 'auto',
defaultIsModuleExports: 'auto',
}),
],
optimizeDeps: {
include: ['qs', 'dayjs'],
},
resolve: {
alias: {
'@': fileURLToPath(new URL(clientScriptsPath, import.meta.url)),
'aem-base': aemBaseClientPath(),
...createLibMock('lib/proxyImport', 'proxyImport'),
...createLibMock('components/mixins/isMobile', 'isMobile'),
components: aemBaseClientPath('scripts/components'),
constants: aemBaseClientPath('scripts/constants'),
lib: aemBaseClientPath('scripts/lib'), …Run Code Online (Sandbox Code Playgroud) 我正在使用Sightly,在调查我的应用程序中的一个错误时,我注意到了一个我没想到的行为.
某些链接会在查询字符串中使用&符号进行两次转义.例:
<a href="http://www.google.com?a=1&amp;b=2&amp;c=3">
link with explicit attribute context
</a>
Run Code Online (Sandbox Code Playgroud)
经过仔细检查,结果发现我们在AEM中运行的org.apache.sling.rewriter.Transformer所有href属性中都有一个实现转义特殊字符.
加上Sightly XSS保护,这导致了双重逃逸.
在进一步研究这个问题时,我禁用了变压器,发现Sightly本身有一种奇怪的行为.
鉴于以下三个元素,我希望它们以href相同的方式呈现值(查询字符串被转义,符合W3C标准)
<a href="${'http://www.google.com?a=1&b=2&c=3'}">no explicit context, expression used</a>
<a href="http://www.google.com?a=1&b=2&c=3">no explicit context</a>
<a href="${'http://www.google.com?a=1&b=2&c=3' @ context='attribute'}">
explicit attribute context
</a>
Run Code Online (Sandbox Code Playgroud)
但是,只有最后一个执行转义,我得到
<a href="http://www.google.com?a=1&b=2&c=3">no explicit context, expression used</a>
<a href="http://www.google.com?a=1&b=2&c=3">no explicit context</a>
<a href="http://www.google.com?a=1&amp;b=2&amp;c=3">
explicit attribute context
</a>
Run Code Online (Sandbox Code Playgroud)
出于某种原因,最后一个,使用context='attribute'(唯一一个与&字符做某事的人)两次逃脱&符号,产生无效链接.
这可以通过任意元素和属性名称来实现,所以我想我可以放心地认为这不是一些重写者.
<stargate data-custom="${'http://www.google.com?a=1&b=2&c=3' @ context='attribute'}">
attribute context in custom tag
</stargate>
Run Code Online (Sandbox Code Playgroud)
输出:
<stargate data-custom="http://www.google.com?a=1&amp;b=2&amp;c=3">
attribute context in custom …Run Code Online (Sandbox Code Playgroud)