Hi Team,
We're currently using a Sling Model for an existing component and are attempting to create an identical component under a different name. Although the JSON data from the Sling Model is being printed(tried with add extra log) correctly according to the code logic, accessing the JSON data through the URL jcr:content/root/container/container/container_copy_copy_/column1_copy/container_2045280733/component-name.list.json results in a 400 Bad Request error. Could you please advise on how to resolve this issue?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Please provide components definitions (node with jcr:primaryType="cq:Component") as well.
Why do you request "JSON data" (Sling Exporter of Sling Model) with list selector? Usually a "model" is used. Try jcr:content/root/container/container/container_copy_copy_/column1_copy/container_2045280733/component-name.model.json.
Hi @neo-silicon ,
Could you please provide more details like Sling Models mapping (definition), 2 components definitions? It will have to identify a problem.
However, I would assume that your new component doesn't have sling:resourceSuperType to old component. Why do you request "JSON data" (Sling Exporter of Sling Model) with list selector? Usually a "model" is used. Try jcr:content/root/container/container/container_copy_copy_/column1_copy/container_2045280733/component-name.model.json.
Best regards,
Kostiantyn Diachenko.
Hi ,
new component calling new sling model: data-sly-use.cardList="com.abc.core.models.new.component.BList"
Old component calling Old sling model: : data-sly-use.cardList="com.abc.core.models.old.component.List"
Views
Replies
Total Likes
Please provide components definitions (node with jcr:primaryType="cq:Component") as well.
Why do you request "JSON data" (Sling Exporter of Sling Model) with list selector? Usually a "model" is used. Try jcr:content/root/container/container/container_copy_copy_/column1_copy/container_2045280733/component-name.model.json.
For exporting the sling model json, the path should be <resourcepath>.model.json
Refer to this guide: Delegation Pattern for Sling Models. The use case for the Title component in this guide closely resembles your own.
Pay particular attention to the sling:resourceSuperType directive in the XML definition of the component, as well as the adapter directive in the Sling Model definition.
@neo-silicon Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies