@Model( adaptables = SlingHttpServletRequest.class, adapters = ComponentExporter.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, resourceType = "myapp/components/structure/page") @Exporter( name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
You need to do like
@Model(adaptables = SlingHttpServletRequest.class, adapters = {MyModel.class, ContainerExporter.class}, resourceType ="myapp/components/structure/page")
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
Can you try something like
@Model(adaptables = SlingHttpServletRequest.class, adapters = {Page.class, ContainerExporter.class}, resourceType = PageImpl.RESOURCE_TYPE) @Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
Hello, thank you for your answer.
Somehow i cannot do
resourceType = PageImpl.RESOURCE_TYPE
Because my IDE doesnt recognize it.
public class MyModel extends ModelJsonExporter implements ComponentExporter{
Could be because my model definition?
Hi,
You need to do like
@Model(adaptables = SlingHttpServletRequest.class, adapters = {MyModel.class, ContainerExporter.class}, resourceType ="myapp/components/structure/page")
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
Yes this is the way, it was not working for some other issue.
Thanks a lot!