Hi Arun,
Adding the data-sly-use call in my navigation component did not pass the request object. I was able to get it working by passing request/response as parameters to my WCMUsePojo class.
<div data-sly-use.dataProvider="${'com.site.aem.dataproviders.NewLinkProvider' @prop=request,propr=response}"></div>
When I tried data-sly-use in my template (basepage.html) it does not have the same issue. I am able to get the correct request/response without passing the parameters.
<html lang="en-US" data-sly-use.dataProvider="${'com.site.aem.dataproviders.NewLinkProvider'}">
Are the request/response objects not available when data-sly-use is added in a component?
This is my class below with the parameters code removed.
public class NewLinkProvider extends WCMUsePojo {
private static final Logger logger = LoggerFactory.getLogger(NewLinkProvider.class);
private String headOpenData;
private String bodyOpenData;
private String bodyStringData;
@Override
public void activate() throws Exception {
//IXF Configuration items have been removed
IXFSDKParameters parameters = new IXFSDKParameters(getRequest());
IXFSDKClient client = new IXFSDKClient(ixfConfig, getResponse(), parameters);
this.headOpenData = client.getHeadOpen();
this.bodyOpenData = client.getBodyOpen();
this.bodyStringData = client.getBodyString("body_1");
}
public String getHeadOpenData() {
return headOpenData;
}
public String getBodyOpenData() {
return bodyOpenData;
}
public String getBodyStringData() {
return bodyStringData;
}
}