since ‎03-02-2021
Online
TB3dock
Level 3
Re: How to search for only pages which are published usin...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Good point!

Views

15

Likes

0

Replies

0
How to search for only pages which are published using querybuilder?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
We are trying to get json from components of specific pages to render on client. We can individually lookup each required page by its template type: path=/content/mysite/en/ type=cq:page 1_property=jcr:content/cq:template 1_property.value=/conf/mysite/settings/wcm/templates/my-page-template some othe properties to narrow down the required page. Then we can do another query to retrieve all its children, and iterate through them looking for the 2 components we required, and then copying each prope...

Views

49

Likes

0

Replies

3
Re: all servlets always called twice!
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Im using the absolute latest cloud SDK on a mac.

Views

26

Like

1

Replies

0
Re: all servlets always called twice!
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
I have tested this, and my service is called twice from the servlet. So this is not just logging, this is 2 complete calls.

Views

28

Like

1

Replies

0
com.adobe.agl.math.BigDecimal vs java.math.BigDecimal
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Any thoughts on which we should use in servlet code, and why adobe created another version?

Views

43

Likes

0

Replies

2
Re: using QueryBuilder how to get the absolute URLs of th...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
This is awesome work! I would never have found this stuff. so to get a resources page is pageManager.getContainingPage(resource). Is there something similar to get all the components of a page?

Views

34

Likes

0

Replies

0
Re: using QueryBuilder how to get the absolute URLs of th...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Below is the response from asutosh_jena which seems to have disappeared from this thread. First you can make a VO or POJO class with all the required fields. Let's say I want to keep page title and page link for now. You can add all the fields that you want. public class SearchResultsList { private String pageTitle; private String pageLink; public String getPageTitle() { return pageTitle; } public void setPageTitle(String pageTitle) { this.pageTitle = pageTitle; } public String getPageLink() { r...

Views

42

Like

1

Replies

0
Re: all servlets always called twice!
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
That doesnt seem possible?

Views

51

Like

1

Replies

0
using QueryBuilder how to get the absolute URLs of the pages of the components found?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Using QueryBuilder we can search for component(s) which contain a property with a specific value (e.g. an ID we are looking for). From this, I need to return some json which includes the properties of the component, the absolute URL of the page this component is on, and the values of some other specific components on the same page, for each hit. E.g. if we have a bunch of game info pages, each having a game info block component which has gameId as a field, I need to search for specific games (e....

Views

107

Likes

0

Replies

6
all servlets always called twice!
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
We have had this issue since the beginning.All servlets, no matter how configured, always get run twice, even though they are only called once. We have the same problem with servlets in wknd, or in our own, completely different project, or in an empty project.We are hitting the local aem sdk author instance on a mace.g this servlet: (service = { Servlet.class }) @SlingServletPaths(value="/bin/test/2") @ServiceDescription("Simple Demo Servlet 2") public class MyServlet extends SlingAllMethodsServ...

Views

97

Likes

0

Replies

7
Re: How to define a servlet path using the new servlet an...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Ok, found the solution:@SlingServletPaths(value="/bin/somepath") private class MyServlet extends SlingAllMethodsServlet

Views

35

Like

1

Replies

0
How to define a servlet path using the new servlet annotations?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
The new way to annotate servlets is like this: @component(service = { Servlet.class }) @SlingServletResourceTypes( resourceTypes="/apps/my/type", methods= "GET", extensions="html", selectors="hello") public class MyServlet extends SlingSafeMethodsServlet { @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { ... } } How can one register by path, not by resource type? The documenation: https://sling.apache.org/do...

Views

52

Likes

0

Replies

2
Re: How to write a servlet via resource type?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Awesome thanks. We have been looking for a tutorial on how to get required content into the git repo for some time, and this might be it. We found the filter.xml in WEB-INF as you say, but are not sure how to combine it with the content you posted. is it this? Or should it be just this?

Views

48

Likes

0

Replies

0
Re: How to write a servlet via resource type?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Hi, where is ui.content filter? We dont seem to have anything like filter.xml in the source code. If we need to add it, which directory does it go in? Below is the source code for wknd. We cant find anything like filter.xml or ui.content/filter.

Views

87

Likes

0

Replies

0
Re: How to write a servlet via resource type?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
This is awesome, we are almost there. Where is the filter.xml we need to edit to add the resource type nodes? In your screen shot, you have a dir called services, which is nice, how can this be created in code?

Views

99

Likes

0

Replies

0
Re: How to write a servlet via resource type?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Thanks for the comment. We know the source code we need to put in the servlet. We dont know what files and file content to put into our git to make the resource type magically appear, and how to link a resource type to the URL to it the servlet.. You have a screen shot of something which appears to have been setup, but how? how to you create or configure a resource type? This is the missing piece from all the turorials and information pages. What do we need to add to our git to make a resource t...

Views

115

Likes

0

Replies

0
Re: How to write a servlet via resource type?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Thanks for the reply; Everything you have said I already know - writing the servlet to use a resource type is easy, but there are no tutorials or guides which tell you how to do the magic step of configuring the resource type and mapping it to a path. This is the missing from every servlet tutorial unfortunately, and means we have to use the path option. In your example you have "ServiceConstants.YOUR_SERVLET_RESOURCE_TYPEWhere does this come from? where is is YOUR_SERVLET_RESOURCE_TYPE defined ...

Views

132

Likes

0

Replies

0
where ware the "new" annotations for servlets?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
This page: https://sling.apache.org/documentation/the-sling-engine/servlets.html has an embeded presentation which has servlet declarations like this: @SlingServiceResourceTypes(resourceTypes="xx/yy/zz") etc. However, all the examples and AEM docs seem to only support this older format: @component(service = Servlet.class, property = { Constants.SERVICE_DESCRIPTION + "=something","sling.servlet.methods=" + HttpConstants.METHOD_GET, "sling.servlet.paths=" + "/bin/api/mypath" }) Is this new format ...

Views

35

Likes

0

Replies

1
How to configure a servlet via resource type?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
There are several tutorials on creating sling servlets. All of them use paths, e.g. "sling.servlet.paths=" + "/bin/readjson" (and this can be hit on www.mysite.com/bin/readjason )All of them say its better to use resource types, e.g. "sling.servlet.resourceTypes="+ "noidea", but how do I hit the servlet? www.mysite.com/noidea doesnt work.What needs to be setup, and how, to use a resource type (and setup in source code - not in the local running AEM instance, where it cannot be distributed to oth...

Views

144

Likes

0

Replies

11
How to create page template with a custom field (or any sort of model), e.g. an ID or code?
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
All the tutorials create page templates either via the UI or via crxde editor. This will create a template on a running instance, not our our source code, so wont get deployed to any of the environments. This is the first issue. The second problem is that when you create a template via UI, there does not seem to be a way to add any fields to it. for example, if we want to create a template for holiday destinations, we could do this via ui, and drag some components such as images or text blocks. ...

Views

42

Likes

0

Replies

1
Betreff: .cfg.json file not working
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
I got the pattern you provided to work thanks. I gave up trying to do it outside of the service (i.e. having a separate class for the config). FYI the log statement inside the activate does not work for me, even if I set it to log.error.

Views

55

Likes

0

Replies

0
Re: New example of osgi config files not working with Aem...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Hi, Inspired by your example, I have pasted mine above. It has what I belive is a more logical structure: a separate config class which only defines the config attributes, a service class and impl which only define the services methods. Any idea why this code (which was taken from someones example) doesnt work with the config files?

Views

125

Like

1

Replies

0
Re: New example of osgi config files not working with Aem...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Looking at the example you kindly provided, its very different from every other service implementation i have found. In the others, the service interface defines service methods, not the AttributeDefinitions. A service should expose its services, not intrnal cong attributes which are not exposed outside the service?

Views

133

Like

1

Replies

0
Re: New example of osgi config files not working with Aem...
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Hi, I have spent now 8 man days trying to get a config file read. It simply doesnt work in my env. I suspect its a bug in the latest cloud SDK. Which version of the SDK are you using? The code I have used here is simply the code from the github example, with nothing but a search and replace on the package names. It works perfectly, with the correct PID etc, except for the .cfg.json files dont work. i have tried other examples, and get the same problem. I have tried every possible conceivable var...

Views

137

Like

1

Replies

0
New example of osgi config files not working with Aem cloud SDK.
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
I tried and failed to get osgi config files to work in my own code as discussed here.I found one example on the web of someone else who has created an OSGI config the same as mine, but unfortunately, they also don't include a config file.I took their source code, added it to my project, added a config file, and get same result - AEM is ignoring the config file.I suspect this is a problem with eithermy env (M1 Mac running Java 11),a bug in the latest AEM cloud SDK,a problem with the wknd sample p...

Views

182

Likes

0

Replies

6
Betreff: .cfg.json file not working
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
The crux is that the deployment creates two duplicate OSGi config in the configmanager, both with the same PID. One is created by default, the other is created by my cfg.json file. The service is getting its settings from the wrong one, and there appears to be nothing I can do about it.

Views

153

Likes

0

Replies

0
Betreff: .cfg.json file not working
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Hi why did you add @Designate(ocd=SimpleServlet.Config.class) instead of @Designate(ocd=SimpleServlet.class)? presumably SimpleServlet.Config is not a class?

Views

165

Likes

0

Replies

0
Betreff: .cfg.json file not working
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Great if you can share the source of the working version, I can try to work the example service I have backwards.

Views

182

Likes

0

Replies

0
Betreff: .cfg.json file not working
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
Now everything seems to be "correct" is this a bug in AEM?

Views

201

Likes

0

Replies

0
Betreff: .cfg.json file not working
Avatar

TB3dock

TB3dock
- Adobe Experience Manager
After various updates (see question), My json file is now called /aem-guides-wknd.ui.config/src/main/content/jcr_root/apps/wknd/osgiconfig/config/com.adobe.aem.guides.wknd.core.services.MySeviceImpl.cfg.json and its PID matches the PID of the "duplicate" config which is generated, and is actually used. I renamed the methods to just int timeout() etc. as suggested. This does not help - its still not getting any config via the json file, its getting it from another config in configmanger (the one ...

Views

202

Likes

0

Replies

0