aem

How can I create an instance of WCMUsePojo in a servlet for a specific page?

我与影子孤独终老i 提交于 2019-12-23 03:26:20
问题 I am trying to create an instance of WCMUsePojo in a servlet. The implementing class is already used in sightly templates. I have tried code below and could not get it to work. Any ideas? Thanks. @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { try { Resource resource = request.getResource().getResourceResolver().getResource ("/content/mynewsite/homepage"); WCMUsePojo template = resource.adaptTo(BaseTemplate.class);

how to handle 500 error

我只是一个虾纸丫 提交于 2019-12-23 03:23:18
问题 I'm trying to show custom error message for 404/403/500 error. I'm able to show 404/403 error but unable to show 500 error. Steps I have followed so far - Step 1 : Created a servlet which will set the status as 500 public class ErrorServlet extends SlingSafeMethodsServlet { @Override protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException { try{ response.setStatus(500); } catch (Exception e) { e.printStackTrace(

AEM Sightly to get properties of child nodes.

别等时光非礼了梦想. 提交于 2019-12-23 03:11:41
问题 So it looks like sightly is great for getting properties, but I would like to work get properties of other child nodes that I have defined. Here is the start of my PictureFill Component structure: { jcr:primaryType: "nt:unstructured", jcr:createdBy: "admin", fileReference: "/content/dam/myapp/dev/hero-billboard.jpg", jcr:lastModifiedBy: "admin", jcr:created: "Wed Oct 07 2015 03:38:00 GMT+0000", jcr:lastModified: "Wed Oct 07 2015 16:54:12 GMT+0000", sling:resourceType: "myapp/components

AEM sightly how to reuse variables

…衆ロ難τιáo~ 提交于 2019-12-22 18:04:10
问题 can I use variables in another file that I'm including? in my HTL (file1.html) I have: <sly data-sly-test.myVar="${properties.myVarFromDialog}"></sly> <sly data-sly-include="/file2.html"></sly> Can I use myVar in file2.html ? I'm not getting any value. Is there a way of getting that value from file1.html to use in file2.html 回答1: You should use data-sly-template for this. You can define templates in a separate file and can pass in parameters. For an explanation on templates check the

Adobe CQ/AEM - trigger afteredit handler

戏子无情 提交于 2019-12-22 09:56:17
问题 When I select "OK" in a component editor dialog, the component redraws itself, assuming I've got the _cq_editConfig.xml set up: <cq:listeners jcr:primaryType="cq:EditListenersConfig" afteredit="REFRESH_SELF"/> What I'd like to do is trigger "afteredit" via javascript. I've got a situation where the content has been changed and the author should have an updated view of the rendered component, but I don't know how to do this short of reloading the entire page or opening and closing the edit

How to enable WebDAV in Adobe AEM?

走远了吗. 提交于 2019-12-22 07:57:20
问题 I am trying to access Adobe AEM via WebDAV, however, I cannot get it to work. I am running the out-of-the-box crx-quickstart, so I am using port 4502 and the default workspace. I am using Windows Explorer as the WebDAV client, which I use to connect to Sharepoint without difficulty. These seem to be the only instructions for connecting to AEM via WebDAV. http://dev.day.com/docs/en/crx/current/how_to/webdav_access.html The instructions imply that you just point your WebDAV client at the

Iteration (for loop) in sightly

北战南征 提交于 2019-12-22 06:28:15
问题 I had used <c:forEach> in jstl. Now i want to use sightly. My usecase is to print numbers from 1 to 10 then how can i iterate in sightly as for loop in java 回答1: Sightly doesn't let you put any logic in it by design. What you should do is, you should customize your underlying model so that you can retrieve a prepared list of irrelevant (from Sightly's perspective) length that contains data that needs to be displayed. After that, just use data-sly-list . You'll need to google for more details,

Including a JSP into a sling servlet

天大地大妈咪最大 提交于 2019-12-21 20:54:15
问题 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 login in a SlingAllMethodServlet Gist of servlet definition: package definition... import statements... @SuppressWarnings("serial") @SlingServlet( resourceTypes="path/to/my/component", methods="GET", extentions="HTML") @Properties({ @Property(name="service.pid", value="<my service class>",

How to write an nt:file programmatically

て烟熏妆下的殇ゞ 提交于 2019-12-21 20:08:03
问题 I'm trying to store binary data in JCR, which is created on the fly. My problem is that the only way provided by the JCR API is via an InputStream : Session session = request.getResourceResolver().adaptTo(Session.class); ValueFactory valueFactory = session.getValueFactory(); Binary bin = valueFactory.createBinary(is); As CQ/Sling is RESTful I can see why this is the case as you usually get a form post or an httprequest to another source, where you always have an InputStream to use. But in my

How to create a radio button in aem 6 touch dialog

梦想的初衷 提交于 2019-12-21 19:58:17
问题 I am having a touch UI component for which I am creating a dialog in AEM 6. I have a requirement to create 2 radio buttons in the touch dialog and if either one of them are selected, the corresponding value of the selected radio button should be displayed. however, I am not understanding how to create the radio button options. I have implemented the same in classic dialog where the xtype=selection and type=radiogroup is used, but I do not understand how to create it in touch dialog 回答1: You