Sling Models request object
Hi All,
I want to use the SlingHttpServletRequest request object in another sling model.
For ex.-
@Getter
@Model(adaptables = {Resource.class,SlingHttpServletRequest.class}, adapters = Header.class,
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class Header{
@SlingObject
Resource componentResource;
@SlingObject
SlingHttpServletRequest servletrequest;
@ValueMapValue
private String fileLarge;
@ChildResource(name = "b2cnavigationItem")
private List<navigation> b2cnavigationItem;
}
@Model(adaptables = {Resource.class,SlingHttpServletRequest.class}, adapters = navigation.class,
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class navigation{
@SlingObject
Resource resource;
@OSGiService
SlingHttpServletRequest request;
@ValueMapValue
String domain;
@Getter
@ValueMapValue
private String navigationText;
@Getter
@ValueMapValue
private String navigationLink;
@ValueMapValue
private String expFragPath;
}
Above is the code, Now I want to use the request object in "navigation" class. but I am getting Null.
However, I am getting request object in Header Class. but not getting in navigation class.
Can anyone help me here? I want to append the Request Url host in the expFragPath variable.
