Context Path "/" in v13: problem with web files

#1

Hi,

We are currently on version 12.4 and in process to upgrade to version 13.1. Our delivery application is currently deployed at the root of Tomcat - context path is “/”. We package our delivery application inside a ROOT.war and deploy it to Tomcat.

But in version 13, when context path is set to “/”, I encountered some problems while fetching web files (e.g. templates, …) from repository. I tried debugging and found an issue in change that was made in WebFileUtils class (org.hippoecm.hst.util.WebFileUtils):

v12.4:

public static String getBundleName(HstRequestContext requestContext) {
    String bundleName = requestContext.getResolvedMount().getMount().getContextPath();
    if (bundleName != null && bundleName.length() != 0) {
        if (bundleName.startsWith("/")) {
            bundleName = bundleName.substring(1);
        }
    } else {
        bundleName = "site";
    }

    return bundleName;
}

v13.1

public static String getBundleName(HstRequestContext requestContext) {
    Mount reqMount = requestContext.getResolvedMount().getMount();
    String bundleName = reqMount.getContextPath(); 
    if (bundleName.startsWith("/")) {
        bundleName = bundleName.substring(1);
    }

    return bundleName;
}	

So in v12 function “getBundleName” returns value “site” even though reqMount.getContextPath() method returns value “/”. On the other hand in v13 method “getBundleName()” returns an empty string, given the same input and project configuration. Web files are then not found,
because they are saved in JCR under “/webfiles/site/freemarker/” path and not under “/webfiles/freemarker/…”. Do you have an idea what do I have to do, to keep using delivery application with context path “/” on v13?

Thanks!

#2

Hi,
From my understanding you have some issues while HST is trying to fetch web files, like templates. This process is automatically handled by XM during the rendering phase, but I think you changed something here.
Have you customised HST components in order to set templates dynamically?

Can you also explain how your are using the getBundleName method ?

Thanks

#3

support for root war is dropped in v13,
see:

Known issues

  • root.war deployment not supported anymore
    • no best practice for development-scoped HST configuration / webfiles in Multi Site Mode
    • custom site provider for campaigns not supported
    • selection of menu items in menu editor is broken (CHANNELMGR-2253)
    • no easy way to start the full sync manually (ENT-1372)
#4

Hi,

Have you customised HST components in order to set templates dynamically?

We set templates statically via “hst:template” property on components in JCR. I believe we don’t use any special configuration regarding fetching templates and other web files. The only thing I can think of is root context path for site application that I mentioned earlier.

Can you also explain how your are using the getBundleName method ?

getBundleName() method gets called first time I try to load my site. I don’t call it explicitly in my code. I suppose at that time it needs to load template (ftl) files from repository. I debugged even further and value for bundleName apparently comes out of javax.servlet.ServletContext object.

Br, Blaz

#5

support for root war is dropped in v13

Thanks for the answer @machak. Do you know maybe if it will be supported again in the near future?

#6

Hi,

I don’t there are such plans.