Sling Model Binary Inject | Community
Skip to main content
Level 9
April 4, 2023

Sling Model Binary Inject

  • April 4, 2023
  • 1 reply
  • 2135 views

Hi,

 

trying to adapt to resource class and i have a binary field with @586265. I try accessing the binary field and it says org.apache.sling.models.impl.injectors.ResourcePathInjector Could not retrieve resource at path {{the values stored at the variable }} for field {{property name}}. Since it is required it won't be injected.

 

So tried adapting to valuemapvalue,error is gone but the property is null  or does not exist

any inputs?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

arunpatidar
Community Advisor
Community Advisor
April 5, 2023

I would say adapt as resource or then read the binary property using InputStream.

Arun Patidar
Level 9
April 5, 2023

I did the same but are you trying to say adapt the property as resource? Can you please elaborate and give some more details on how this can be done 

 

nodeA has property 

binaryprop binary value 

arunpatidar
Community Advisor
Community Advisor
April 5, 2023

HI @nitrohazedev 
I meant the image node resources can be adapted/injected as resources/Node and then read jcr:data property

https://github.com/arunpatidar02/aem63app-repo/blob/07cfd85afdd5970096b6f4c7b9d1e0db976cb6d3/java/dropdown/PopulateTouchUIDropdownFromJSON.java#L135 

Arun Patidar