@Codelime Please see the below highlighted code
package com.adobe.business.core.models;
import com.adobe.business.core.utils.Markdown;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
import javax.annotation.PostConstruct;
@Model(adaptables = {SlingHttpServletRequest.class, Resource.class}, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class TextModel extends AbstractComponentModel {
@ValueMapValue(name = "backgroundColor")
private String backgroundColor;
@ValueMapValue(name = "textColor")
private String textColor;
@ValueMapValue(name = "text")
private String text;
@ValueMapValue(name = "fullWidth")
private boolean fullWidth;
public String getBackgroundColor() {
return backgroundColor;
}
public String getTextColor() {
return textColor;
}
public boolean getFullWidth() {
return fullWidth;
}
public String getText() {
String out = text;
if (out.contains(".jpg")) {
out.replaceAll(".jpg", ".jpeg/_jcr_content/renditions/cq5dam.web.816.480.jpeg");
} else if (out.contains(".jpeg")) {
out.replaceAll(".jpeg", ".jpeg/_jcr_content/renditions/cq5dam.web.816.480.jpeg");
} else if (out.contains(".png")) {
out.replaceAll(".png", ".jpeg/_jcr_content/renditions/cq5dam.web.816.480.jpeg");
}
return Markdown.parse(text);
}
@PostConstruct
private void initModel() {
Markdown.setResourceResolver(this.getResource().getResourceResolver());
}
}
Not sure what is the functionaity written in Markdown.setResourceResolver method as it's specific to your project. Can you comment out these code and see if it works.
Also I have made some changes to the injection property. Removed few of the attributes on the Model annotation. Please retry.
Thanks!