public static void initPageVariables(JellyContext context) { StaplerRequest currentRequest = Stapler.getCurrentRequest(); String rootURL = currentRequest.getContextPath(); Functions h = new Functions(); context.setVariable("h", h); // The path starts with a "/" character but does not end with a "/" character. context.setVariable("rootURL", rootURL); /* load static resources from the path dedicated to a specific version. This "/static/VERSION/abc/def.ghi" path is interpreted by stapler to be the same thing as "/abc/def.ghi", but this avoids the stale cache problem when the user upgrades to new Jenkins. Stapler also sets a long future expiration dates for such static resources. see https://wiki.jenkins-ci.org/display/JENKINS/Hyperlinks+in+HTML */ context.setVariable("resURL",rootURL+getResourcePath()); context.setVariable("imagesURL",rootURL+getResourcePath()+"/images"); context.setVariable("userAgent", currentRequest.getHeader("User-Agent")); IconSet.initPageVariables(context); }
public static void initPageVariables(JellyContext context) { StaplerRequest currentRequest = Stapler.getCurrentRequest(); String rootURL = currentRequest.getContextPath(); Functions h = new Functions(); context.setVariable("h", h); // The path starts with a "/" character but does not end with a "/" character. context.setVariable("rootURL", rootURL); /* load static resources from the path dedicated to a specific version. This "/static/VERSION/abc/def.ghi" path is interpreted by stapler to be the same thing as "/abc/def.ghi", but this avoids the stale cache problem when the user upgrades to new Jenkins. Stapler also sets a long future expiration dates for such static resources. see https://wiki.jenkins-ci.org/display/JENKINS/Hyperlinks+in+HTML */ context.setVariable("resURL",rootURL+getResourcePath()); context.setVariable("imagesURL",rootURL+getResourcePath()+"/images"); context.setVariable("userAgent", currentRequest.getHeader("User-Agent")); IconSet.initPageVariables(context); }