Class SmapUtil
java.lang.Object
org.apache.jasper.compiler.SmapUtil
Contains static utilities for generating SMAP data based on the current version of Jasper.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidevaluateNodes(Node.Nodes nodes, SmapStratum s, HashMap<String, SmapStratum> innerClassMap, boolean breakAtLF) Traverses the JSP AST nodes and populates the given SmapStratum with line mapping data.static Map<String, SmapStratum> generateSmap(JspCompilationContext ctxt, Node.Nodes pageNodes) Generates an appropriate SMAP representing the current compilation context.static voidinstallSmap(Map<String, SmapStratum> smapInfo) Installs SMAP data into the compiled class files by writing the SourceDebugExtension attribute.static SmapStratumloadSmap(String className, ClassLoader cl) Loads SMAP data for the given class by reading the embedded SourceDebugExtension attribute from the class file or an external .smap resource.
-
Constructor Details
-
SmapUtil
public SmapUtil()Default constructor.
-
-
Method Details
-
generateSmap
public static Map<String, SmapStratum> generateSmap(JspCompilationContext ctxt, Node.Nodes pageNodes) throws IOException Generates an appropriate SMAP representing the current compilation context. (JSR-045.)- Parameters:
ctxt- Current compilation contextpageNodes- The current JSP page- Returns:
- a SMAP for the page
- Throws:
IOException- Error writing SMAP
-
installSmap
Installs SMAP data into the compiled class files by writing the SourceDebugExtension attribute.- Parameters:
smapInfo- the SMAP data keyed by fully qualified class name- Throws:
IOException- if an I/O error occurs while writing class files
-
evaluateNodes
public static void evaluateNodes(Node.Nodes nodes, SmapStratum s, HashMap<String, SmapStratum> innerClassMap, boolean breakAtLF) Traverses the JSP AST nodes and populates the given SmapStratum with line mapping data.- Parameters:
nodes- the root JSP AST nodess- the stratum to populate with line mappingsinnerClassMap- map to collect SMAP data for inner classesbreakAtLF- whether to generate a mapping for each line feed in template text
-
loadSmap
Loads SMAP data for the given class by reading the embedded SourceDebugExtension attribute from the class file or an external .smap resource.- Parameters:
className- the fully qualified class namecl- the class loader to use for loading the resource- Returns:
- the parsed SmapStratum, or
nullif no or invalid SMAP data is found
-