Skip to content

Commit

Permalink
Updated TabFilter to support AEM context paths
Browse files Browse the repository at this point in the history
  • Loading branch information
paullegan committed May 20, 2020
1 parent 0901ca3 commit 7c328b6
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public void doFilter(ServletRequest pRequest, ServletResponse pResponse, FilterC
String componentPath = fullRequestPath.substring(0, fullRequestPath.lastIndexOf("/"));
String dialogPath = getInheritDialog(slingRequest);
if (dialogPath != null) {
LOGGER.debug("dialog path => " + dialogPath);
Resource dialogNodeRes = slingRequest.getResourceResolver().getResource(dialogPath);
if (dialogNodeRes != null) {
Node dialogNode = dialogNodeRes.adaptTo(Node.class);
Expand Down Expand Up @@ -196,8 +197,16 @@ private void getOriginalTabsFromRes(Node nodeItem, JSONObject originalTabs) thro
private String getInheritDialog(SlingHttpServletRequest slingRequest) throws RepositoryException {
String fullRequestPath = slingRequest.getRequestURI();
String componentPath = fullRequestPath.substring(0, fullRequestPath.lastIndexOf("/"));

if (slingRequest.getContextPath().length() > 0) {
componentPath = componentPath.replace(slingRequest.getContextPath(), "/");
}

String result = null;

LOGGER.trace("contextPath --> " + slingRequest.getContextPath());
LOGGER.trace("componentPath to start --> " + componentPath);

Resource componentRes = slingRequest.getResourceResolver().getResource(componentPath);
int avoidLoop = 0;

Expand Down

0 comments on commit 7c328b6

Please sign in to comment.