| /* | |
| Open a page which is having component /apps/project/components/page/page | |
| /content/project/en/jcr:content.model.json | |
| Don't miss jcr:content in the path. Add jcr:content.model.json | |
| */ | |
| package com.org.project.models; | |
| import javax.annotation.PostConstruct; | |
| import javax.inject.Inject; | |
| import javax.inject.Named; | |
| import javax.jcr.Node; | |
| import javax.jcr.RepositoryException; | |
| import org.apache.sling.api.resource.Resource; | |
| import org.apache.sling.api.resource.ResourceResolver; | |
| import org.apache.sling.models.annotations.Exporter; | |
| import org.apache.sling.models.annotations.Model; | |
| import org.apache.sling.models.annotations.Required; | |
| import org.apache.sling.models.annotations.Source; | |
| import org.apache.sling.models.annotations.injectorspecific.Self; | |
| import com.day.cq.wcm.api.Page; | |
| @Model(adaptables = Resource.class, resourceType = "/apps/project/components/page/page") | |
| @Exporter(name = "jackson", extensions = "json") | |
| public class PageModelExporter { | |
| @Self | |
| private Resource resource; | |
| @Inject @Named("jcr:title") @Required | |
| private String title; | |
| @PostConstruct | |
| private void init() { | |
| } | |
| public String getTitle() { | |
| return title; | |
| } | |
| } |
Thursday, 2 August 2018
Basic Sling Model Exporter
Subscribe to:
Post Comments (Atom)
Basic Sling Model Exporter
/* Open a page which is having component /apps/project/components/page/page /content/project/en/jcr:content.model.json Don't miss...
-
Namastey, Templates are basis of AEM page. Author can create a page using a template . These templates define basic structure of the ...
-
Namastey, If you are working on your local machine and have created a sling servlet to make post request to local AEM Server , you may be...
No comments:
Post a Comment