Source:
<code>protected void exposeHelpers(Context velocityContext, HttpServletRequest request) throws Exception { velocityContext.put(ADMINISTRATOR, true); velocityContext.put(GROUP_ADMINISTRATOR, true); velocityContext.put(TEMPLATE_ADMINISTRATOR, true); velocityContext.put(VIEW_ADMINISTRATOR_RIGHTS, true); velocityContext.put(USE_COMPRESS_JS, systemEnvironment.useCompressedJs()); velocityContext.put("jyoti", this); Boolean useNewRails = systemEnvironment.get(SystemEnvironment.USE_NEW_RAILS); velocityContext.put(USE_NEW_RAILS, useNewRails); if (useNewRails) { if (systemEnvironment.useCompressedJs()) { <START> RailsAssetsHelper helper = new RailsAssetsHelper(((Request) request).getContext()); <END> velocityContext.put(COMPRESSED_JAVASCRIPT_FILE_PATH, helper.getAssetPath("application.js")); velocityContext.put(COMPRESSED_APPLICATION_CSS_FILE_PATH, helper.getAssetPath("application.css")); velocityContext.put(COMPRESSED_VM_CSS_FILE_PATH, helper.getAssetPath("vm/application.css")); velocityContext.put(COMPRESSED_CSS_CSS_FILE_PATH, helper.getAssetPath("css/application.css")); } else { velocityContext.put(JAVASCRIPTS_PATH_IN_DEV_ENV, "assets"); } } else { velocityContext.put(COMPRESSED_JAVASCRIPT_FILE_PATH, "compressed/all.js?#include(\"admin/admin_version.txt.vm\")"); velocityContext.put(JAVASCRIPTS_PATH_IN_DEV_ENV, "javascripts"); } SecurityContext securityContext = (SecurityContext) request.getSession().getAttribute( SPRING_SECURITY_CONTEXT_KEY); if (securityContext == null || securityContext.getAuthentication() == null) { return; } final Authentication authentication = securityContext.getAuthentication(); setPrincipal(velocityContext, authentication); setAdmininstratorRole(velocityContext, authentication); }</code><technical_language>this static? loaded once? RailsAssetsHelper#init a FileSystem operation hamper performance if for request</technical_language>

Target:
protected void exposeHelpers(Context velocityContext, HttpServletRequest request) throws Exception { RailsAssetsService railsAssetsService = getRailsAssetsService(); velocityContext.put(ADMINISTRATOR, true); velocityContext.put(GROUP_ADMINISTRATOR, true); velocityContext.put(TEMPLATE_ADMINISTRATOR, true); velocityContext.put(VIEW_ADMINISTRATOR_RIGHTS, true); velocityContext.put(USE_COMPRESS_JS, systemEnvironment.useCompressedJs()); Boolean useNewRails = systemEnvironment.get(SystemEnvironment.USE_NEW_RAILS); velocityContext.put(USE_NEW_RAILS, useNewRails); if (useNewRails) { velocityContext.put(CONCATENATED_JAVASCRIPT_FILE_PATH, railsAssetsService.getAssetPath("application.js")); velocityContext.put(CONCATENATED_APPLICATION_CSS_FILE_PATH, railsAssetsService.getAssetPath("application.css")); velocityContext.put(CONCATENATED_VM_APPLICATION_CSS_FILE_PATH, railsAssetsService.getAssetPath("vm/application.css")); velocityContext.put(CONCATENATED_CSS_APPLICATION_CSS_FILE_PATH, railsAssetsService.getAssetPath("css/application.css")); } else { velocityContext.put(CONCATENATED_JAVASCRIPT_FILE_PATH, "compressed/all.js?#include(\"admin/admin_version.txt.vm\")"); } SecurityContext securityContext = (SecurityContext) request.getSession().getAttribute( SPRING_SECURITY_CONTEXT_KEY); if (securityContext == null || securityContext.getAuthentication() == null) { return; } final Authentication authentication = securityContext.getAuthentication(); setPrincipal(velocityContext, authentication); setAdmininstratorRole(velocityContext, authentication); }