Class ScriptLinkHelper

java.lang.Object
org.apache.ofbiz.widget.model.ScriptLinkHelper

public final class ScriptLinkHelper extends Object
Utility to support different handling of code blocks in an html template: 1. Inline javascript tags are turned into external javascript tags for better compliance of Content Security Policy. These external javascript tags are placed at the bottom of the html page. The scripts are retrieved via the getJs request handler.
  • Field Details

  • Method Details

    • getScriptLinksForBodyEnd

      public static Set<String> getScriptLinksForBodyEnd(HttpServletRequest request)
      get the script links for page footer. Also @see ScriptTagsFooterTransform
      Parameters:
      request -
      Returns:
    • getScriptFromCache

      public static String getScriptFromCache(HttpSession session, String fileName)
      Remove script from cache after reading.
      Parameters:
      session -
      fileName -
      Returns:
      script to be sent back to browser
    • cleanupScriptCache

      public static void cleanupScriptCache(HttpSession session)
      cleanup the script cache when user session is invalidated.
      Parameters:
      session -
    • prepareScriptLinkForBodyEnd

      public static String prepareScriptLinkForBodyEnd(HttpServletRequest request, String fileName, String script)