Questions tagged [sling]

Apache Sling is a web framework that uses Java Content Repository to store and manage content. It also uses OSGi (Apache Felix) for dynamic loading.

sling
Filter by
Sorted by
Tagged with
13 votes
4 answers
21k views

ResourceResolverFactory getServiceResourceResolver throws Exception in AEM 6.1

I want to write some data to AEM, and the below code works fine for me in AEM 6.0 but not in AEM 6.1 , always throws a Login Exception as follows: "Login Exception when obtaining a CRX User for the ...
Suren Konathala's user avatar
13 votes
6 answers
69k views

How to convert HTTP Request Body into JSON Object in Java

I am trying find a Java lib/api that will allow me to turn the contents of a HTTP Request POST body into a JSON object. Ideally I would like to use a Apache Sling library (as they are exposed in my ...
empire29's user avatar
  • 3,809
4 votes
1 answer
11k views

How to use/understand AEM Sling Resource Merger, override and Overlay concepts

Am trying to understand the AEM Sling Resource Merger concept. As per the Adobe docs examples Override (Configuring your Page Properties), Overlay (Customizing the Consoles (touch-optimized UI)) am ...
krish's user avatar
  • 479
3 votes
1 answer
6k views

Unable to deploy SlingServlet in CQ

I'm trying to create a servlet in CQ to access some back-end services. Then from my page will make an AJAX call to get the response from servlet. @Component(immediate = true, metatype = false, label =...
kallada's user avatar
  • 1,869
29 votes
3 answers
18k views

What is the purpose behind building of Apache Sling, Felix, Jackrabbit projects

I am asking a very basic question here. Question is I am using Apache Sling , Apache Jackrabbit, Apache Felix in my project as said by my instructor. I am trying to understand why these software is ...
devsda's user avatar
  • 4,202
14 votes
3 answers
22k views

How to set a resource property

I have a Sling Resource object. What is the best way to set or update its property?
Tomek Rękawek's user avatar
13 votes
7 answers
22k views

Determine runmode in Adobe CQ

How do I programmatically know which run-mode the instance is running? I created a custom tag that provides the config depending on the instance run-mode, but I can not determine the current run-mode. ...
Hleb's user avatar
  • 7,131
7 votes
1 answer
901 views

Which config is applied when number of matched run modes is the same

I am using OSGI config files to define configuration for different environments, as specified in OSGI Configuration. I have configurations for multiple run modes saved in the same repository. The ...
Shawn's user avatar
  • 8,667
5 votes
3 answers
8k views

How to work with a bundle in eclipse when it was downloaded from AEM

I downloaded a zip from a running instance of AEM from package manager - http://localhost:4502/crx/packmgr/index.jsp. The zip file, when extracted contains, jcr_root and META-INF. I would like to ...
birdy's user avatar
  • 9,486
5 votes
1 answer
5k views

Sling resource vs nodes

I'm having trouble understanding why you would use resources instead of nodes in sling. So say I have something simple accessing nodes like below: NodeIterator headerNode = currentNode.getNodes(); //...
Delmon Young's user avatar
  • 2,033
4 votes
2 answers
7k views

Why we extends WCMUsePojo class while working with AEM?

Why we extends WCMUsepojo abstract class in our program while working with AEM? What is the advantage of using this class?
Rashid's user avatar
  • 355
3 votes
1 answer
3k views

Set a CQ5 component to editable or not editable

Is it posible if i want to set a cq5 component editable in page A, but not editable in page B. For example: at page A, i have C component we allow authors to open dialog and edit the component. But ...
Tien Nguyen's user avatar
  • 4,318
3 votes
2 answers
10k views

How to create a system user (rep:SystemUser) in AEM 6.1?

On AEM 6.1.. I am trying to create a System User (rep:SystemUser). Can anyone help me? I need this system-user to map to a service in OSGI that i want to use to Write some data to aem content. I ...
Suren Konathala's user avatar
2 votes
1 answer
743 views

Should I close the session before closing the resource resolver

I have simple service, lets use resourceResolver and session for some logic: @Component(immediate = true) @Service(value = ServiceInterface.class) public class ServiceInterfaceImpl implements ...
dzenisiy's user avatar
  • 865
2 votes
1 answer
912 views

Sling initial content loading - how to set access permissions?

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 ...
Markus's user avatar
  • 452
1 vote
2 answers
7k views

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

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 ...
Behrang Saeedzadeh's user avatar
1 vote
2 answers
4k views

How to map urls?

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....
Ronald's user avatar
  • 2,831
0 votes
1 answer
102 views

Method duplicates output

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. ...
Delmon Young's user avatar
  • 2,033
0 votes
2 answers
3k views

CQ5 QueryBuilder Reference in Sling Servlet

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(...
Juan Ayala's user avatar
  • 3,458
11 votes
3 answers
24k views

Getting OSGi services from a bundle in Sling/CQ

I am using Day CQ. I want to store some data in a SQL Server DB, using the connection pool available in the Felix console. I can do this from a JSP, by using the "sling" object of type ...
joelt's user avatar
  • 2,680
9 votes
2 answers
5k views

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

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] --------------------------------------------------...
user1291536's user avatar
8 votes
1 answer
12k views

What's the purpose of resourceResolver.adaptTo(Session.class) in Apache Sling?

I am new to Apache Sling, CQ5, etc. In our codebase, we have a code snippet similar to this: void perform(SlingHttpServletRequest request, SlingHttpServletResponse response) { ResourceResolver ...
TheFooProgrammer's user avatar
7 votes
2 answers
5k views

How to implement a custom AdapterFactory for Sling Resource?

The Adobe AEM software provides several classes which can take an apache Sling Resource and adapt it to another class like so: Page page = resource.adaptTo(Page.class); To use this syntax with ...
jedatu's user avatar
  • 4,113
7 votes
4 answers
30k views

CQ5: 403 Forbidden occurs when call a Post servlet

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; ...
Tien Nguyen's user avatar
  • 4,318
5 votes
2 answers
9k views

AEM 6.1 Sightly basic form submit and redirect to same page

I am trying to do the following on AEM 6.1: Develop a simple form (3 input fields) Process the submitted values, And redirect to the same page with processed values/result I am able to submit the ...
Suren Konathala's user avatar
5 votes
1 answer
7k views

How to debug Groovy code via the remote Java application debugging in Eclipse

I'm struggling to debug an application that builds as a Sling bundle. The application is almost entirely Groovy code (I have the Groovy Eclipse plug-in), and Eclipse (using Maven) is building the .jar ...
Nick Golding's user avatar
4 votes
2 answers
3k views

What is the lifecycle of a jsp PageContext object - is it threadsafe?

Are jsp PageContext objects created and destroyed as part of the http request-response cycle or are they cached and reused between requests. PageContext has life-cycle methods that suggest reuse ...
murungu's user avatar
  • 2,160
4 votes
1 answer
2k views

How to add additional element to htmlparser generator

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 ...
nerd's user avatar
  • 859
4 votes
5 answers
5k views

Is it possible to place variables into a resource path within a sling servlet?

We are trying to provide a clean URI structure for external endpoints to pull json information from CQ5. For example, if you want to fetch information about a particular users history (assuming you ...
Bayani Portier's user avatar
3 votes
1 answer
3k views

How does AEM resolve the JSON extension?

In CQ, if I request a resource such as localhost:4502/content/geometrixx/en.json, I would get the node information in JSON format. The same applies for the XML extension as well. My question is, where ...
Shashi's user avatar
  • 746
3 votes
1 answer
9k views

How to add multivalue property to jcr node through java code?

According this answer https://stackoverflow.com/a/18726682/2674303 I see that I can add property to node in crxde. But I don't understand how can I add multivalue property(array) to node. Please, ...
gstackoverflow's user avatar
3 votes
2 answers
2k views

Including a JSP into a sling servlet

I'm currently working on a small project, trying to help someone figure out how to wire up a component. Ideally we'd like to do 2 things: have a jsp that renders the template have all our business ...
Brodie's user avatar
  • 8,579
3 votes
1 answer
1k views

Sling Resolution script calling order

I was looking over how sling will call the script on the basis of url. In the case of selector it seems work fine but if i use no selector, its confusing for me to understand: I have a page /content/...
Vivek Dhiman's user avatar
  • 1,967
3 votes
1 answer
8k views

CQ5 - Dynamically populating options in selection xtype

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:...
Delmon Young's user avatar
  • 2,033
3 votes
3 answers
6k views

OSGi component configurable via Apache Felix

I'm a complete newb at this so I apologize in advance. I'm trying to create an OSGi component that simply shows a hello world message and is configurable via the input from felix. Then spits it out ...
Delmon Young's user avatar
  • 2,033
3 votes
1 answer
4k views

how sling rewriter works clarification

I am trying to understand how sling url rewrite works. I'm following this url - http://www.cognifide.com/blogs/cq/multidomain-cq-mappings-and-apache-configuration/ Steps I've done in publish ...
Pakira's user avatar
  • 1,991
2 votes
1 answer
981 views

Advantages of deploying sling + jackrabbit on tomcat?

There are several guides how to deploy Apache Sling on Apache Tomcat. Why would you want to do that? As I understand it, this would mean you are deploying the OSGI container Felix within tomcat, and ...
Dr. Hans-Peter Störr's user avatar
2 votes
2 answers
5k views

Filter request URL before any processing in CQ5.6

In my CQ5.6 application,. as soon as the user hits a URL, I need to edit it using a certain parameters. All this must happen before Sling starts processing the URL. I basically need to convert the ...
Riju Mahna's user avatar
  • 6,788
2 votes
2 answers
3k views

Access to a property in a specific resource via sightly

I want to access to a specific property in resource. The main resource hat two children and the app is in the first one. I want to get a property from the second child. Can i find something like : ...
Ayoub Abid's user avatar
2 votes
3 answers
11k views

org.apache.sling.api.resource,version=[2.3,3) -- Cannot be resolved

Hi I am not able to access content of my project, I have uploaded all the packages which are required to access content from CQ. Only thing I can see is org.apache.sling.api.resource,version=[2.3,...
ankit's user avatar
  • 5,069
2 votes
2 answers
5k views

How do I make a WebDav call using HttpClient?

Specifically I want to call MKCOL through HttpClient to create a folder for Apache Jackrabbit through the Sling REST API. I've tried variants of BasicHttpEntityEnclosingRequest request = new ...
Vinnie's user avatar
  • 12.6k
2 votes
2 answers
1k views

Create a new mixin in sling

I am having trouble create a new custom type to the jackrabbit in apache sling using the below code. This worked fine straight on Jackrabbit but not on Apache Sling. Am I doing this correctly for ...
NabilS's user avatar
  • 1,421
2 votes
2 answers
3k views

why do we have multiple jsp's for a single component in CQ5?

I am new to CQ5. While learning its concepts i came to know that CQ5 uses Sling framework for request processing and resolves scripts based on best match. I have seen few components( most of them are ...
cqlearner's user avatar
2 votes
1 answer
2k views

Adobe CQ : Regarding Session in Event Listener

I have a question regarding event listener. We have a event listener which listen to delete node event and perform some activity say "send email". While code review i found this, although this code ...
user avatar
2 votes
1 answer
3k views

Disable component editing in CQ/AEM

I've got a variety of situations where I have a component A which uses cq:include to include component B. Both A and B are editable and have dialogs. However, when B is included in A, I'd like to ...
joelt's user avatar
  • 2,680
1 vote
1 answer
241 views

Access Sling's embbed Jackrabbit over RMI

I want to connect to the embedded Jackrabbit in Spring over RMI but can't figure out how. Is the RMI endpoint started? If not how do I start it? Thank you, Marty
Marty's user avatar
  • 11
1 vote
1 answer
2k views

cq5 accessing osgi servlet through Url

I am trying to access following sling servlet using http://localhost:4502/sling/test-services/planet.html But, it is giving 404 error, not sure what I am doing wrong here. @Component @Service(value=...
Sri's user avatar
  • 1,227
1 vote
1 answer
610 views

Is there a way to format multi-valued properties vertically in a Jackrabbit filevault xml doc?

We use FileVault xml files in a git repo to configure our custom OSGi services running in our Adobe Experience Manager instance. This works out really well in many cases, but it seems like we have to ...
Matt Drees's user avatar
1 vote
1 answer
3k views

AEM 6.3 - Creating Event handler using OSGi R6 annotations

I have created an Event handler by following https://github.com/nateyolles/aem-osgi-annotation-demo/blob/master/core/src/main/java/com/nateyolles/aem/osgiannotationdemo/core/listeners/...
user972418's user avatar
1 vote
1 answer
1k views

How can I configure a transformer in a sling rewriting pipeline?

I want to set targets to every <a>-tag on our site but instead of editing the components, I wrote a transformer. How can I configure it? We already have a transformer and a corresponding ...
arnor's user avatar
  • 41