sling

How to add additional element to htmlparser generator

纵饮孤独 提交于 2019-12-04 13:03:15
I want to rewrite links in attributes of span tags with sling rewrite pipeline. The htmlparser generator only calls "a, link, script, img, form, body" elements. How can I add additional element like span to my transformer? An example configuration would be great! I read that a generator-htmlparser node should be created with the includeTags property, but it doesn't work! I tried to create this node under /apps/MY_APP/config/rewriter. There is also an other generatorType (html-generator), which works, but it calls on every html elements, which is not good for performance. I use AEM 5.6.1.

Build Sling Failure: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:integration-test (default-integration-test)

自作多情 提交于 2019-12-04 03:26:15
im trying to build sling cause I need it for a project at the university. Can anyone tell me, how I can solve this error? [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 54.112s [INFO] Finished at: Sun Mar 25 18:51:41 CEST 2012 [INFO] Final Memory: 68M/165M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:integration-test (default-integration-test) on project sling-servlet-archetype: Execution default

CQ5 - Dynamically populating options in selection xtype

最后都变了- 提交于 2019-12-03 17:18:15
I've been banging my head for hours on this now. I'm trying to dynamically populate options in a selection xtype and can't get it to work. Here is my dialog.xml <resourceType jcr:primaryType="cq:Panel" title="Header Type"> <items jcr:primaryType="cq:WidgetCollection"> <headerType jcr:primaryType="cq:Widget" fieldLabel="Header Type" name="./headerType" type="select" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <categories jcr:primaryType="cq:Widget" path="/content/admin/adminView/jcr:content/header-admin-content/cats/type.infinity.json" width="500" xtype="cqinclude" /> <

CQ5: 403 Forbidden occurs when call a Post servlet

守給你的承諾、 提交于 2019-12-03 15:46:04
Hi I'm using this code to create a Post method for my CQ5 example application. package com.adobe.cq.sling; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; import java.rmi.ServerException; import java.util.Dictionary; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.sling.SlingServlet; import org

Method duplicates output

别等时光非礼了梦想. 提交于 2019-12-02 17:07:27
问题 Pretty new to sling and Java so I apologize in advance. But does anybody have any idea why when I'm at the root it's outputting my path twice? It's odd that it only happens at the absolute root. public static String generateTest(Page page, Page rootPage, String bc) { Page parent = page.getParent(); String bread = ""; bread += (parent != null) ? "<li><a href=" + parent.getPath() + ">" + parent.getTitle() + "</a>" : ""; bread += "<li>" + "<a href=" + page.getPath() + ">" + page.getTitle() + "<

Method duplicates output

笑着哭i 提交于 2019-12-02 11:42:23
Pretty new to sling and Java so I apologize in advance. But does anybody have any idea why when I'm at the root it's outputting my path twice? It's odd that it only happens at the absolute root. public static String generateTest(Page page, Page rootPage, String bc) { Page parent = page.getParent(); String bread = ""; bread += (parent != null) ? "<li><a href=" + parent.getPath() + ">" + parent.getTitle() + "</a>" : ""; bread += "<li>" + "<a href=" + page.getPath() + ">" + page.getTitle() + "</a></li>" + bc; return (ifAtRoot(parent , rootPage)) ? breadcrumb : generateTest(parent, rootPage, bread

CQ5 QueryBuilder Reference in Sling Servlet

拥有回忆 提交于 2019-12-02 09:38:55
I am declaring a sling servlet like so @Component(metatype = false) @Service(Servlet.class) @Properties({ @Property(name = "sling.servlet.paths", value = "/bin/foo/bar"), @Property(name = "sling.servlet.methods", value = "POST") }) public class FooBarServlet extends SlingAllMethodsServlet { ... } I override doPost like so @Override protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { ... } And I am able to post from a client. Great! I throw in the following @Reference private QueryBuilder queryBuilder; as per the documentation, a

What am I missing for this CQ5/AEM URL rewriting scenario?

 ̄綄美尐妖づ 提交于 2019-12-02 05:10:07
I basically want short URLs to get resolved and HTML pages to be generated with short URLs for a CQ5 website. So far short URLs are getting mapped to long URLs as expected, but links in the generated HTML pages are not getting shortened. For example, I am expecting the src attribute of the following <script> tag: <script type="text/javascript" src="/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/style/clientlibs.1395978029951.js"></script> To be shortened to: <script type="text/javascript" src="/style/clientlibs.1395978029951.js"></script> But it is not and remains intact. href

Sling initial content loading - how to set access permissions?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 04:22:31
问题 I have a bundle that was generated by the Maven sling-initial-content archetype, that means the content is imported into the repository when the bundle gets installed. I want anonymous users to be able to add child nodes to a specific node and I want to set these permissions automatically on bundle installation. I tried the following (stored as a JSON file in the content directory), but it generates an error: "Cannot load initial content for bundle com.example.acltest : Unable to perform

How to map urls?

江枫思渺然 提交于 2019-12-02 02:49:25
问题 I would like to map pages such domain/content/myProject/home.html to domain/home.html . /content/myProject/ is not needed. I have the following code: String newpath = getResourceResolver().map(page.getPath()); this does not change anything. newpath is stay page.getPath() how to solve this issue? 回答1: Answering as this question as it remains unanswered. Here is an example of how the etc mappings should look like: Trick is you add 2 entries to sling:internalRedirect as / and /content/example/