Hi Arun,
Of course I can. I set it as you proposed, but unfortunately it's not working.
Code used:
@Component(
service = Filter.class,
property = {
EngineConstants.SLING_FILTER_SCOPE + "=" + EngineConstants.FILTER_SCOPE_COMPONENT,
EngineConstants.SLING_FILTER_RESOURCETYPES + "="
+ "cq/experience-fragments/editor/components/experiencefragment",
Constants.SERVICE_RANKING + ":Integer=" + 201
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) servletRequest;
Resource resource = slingRequest.getResource();
ValueMap properties = resource.adaptTo(ValueMap.class);
IncludeOptions options = IncludeOptions.getOptions(servletRequest, true);
options.forceSameContext(true);
options.getCssClassNames().add("footer");
options.setDecorationTagName("div");
filterChain.doFilter(servletRequest, servletResponse);
}
If the options.forceSameContext(true) is set above .getCssClassNames(), it does nothing. If I set it under that method all experience fragments on the page are not editable and I can't pick a new path for the XF via a cq:dialog. (it's not clickable). Service ranking is set to 201 to force it to be above the WCMComponentFilter.
Also, setting the forceSameContext after the getCssClassNames() do not applies the experiencefragment class into div and overrides it with root as on the screenshot:

Sorry for the raw code that I pasted, but when I highlighted it with Java it does not look very nice.