Package org.apache.jasper.compiler
Class SmapUtil
- java.lang.Object
-
- org.apache.jasper.compiler.SmapUtil
-
public class SmapUtil extends java.lang.ObjectContains static utilities for generating SMAP data based on the current version of Jasper.
-
-
Constructor Summary
Constructors Constructor Description SmapUtil()Default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidevaluateNodes(Node.Nodes nodes, SmapStratum s, java.util.HashMap<java.lang.String,SmapStratum> innerClassMap, boolean breakAtLF)Traverses the JSP AST nodes and populates the given SmapStratum with line mapping data.static java.util.Map<java.lang.String,SmapStratum>generateSmap(JspCompilationContext ctxt, Node.Nodes pageNodes)Generates an appropriate SMAP representing the current compilation context.static voidinstallSmap(java.util.Map<java.lang.String,SmapStratum> smapInfo)Installs SMAP data into the compiled class files by writing the SourceDebugExtension attribute.static SmapStratumloadSmap(java.lang.String className, java.lang.ClassLoader cl)Loads SMAP data for the given class by reading the embedded SourceDebugExtension attribute from the class file or an external .smap resource.
-
-
-
Method Detail
-
generateSmap
public static java.util.Map<java.lang.String,SmapStratum> generateSmap(JspCompilationContext ctxt, Node.Nodes pageNodes) throws java.io.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:
java.io.IOException- Error writing SMAP
-
installSmap
public static void installSmap(java.util.Map<java.lang.String,SmapStratum> smapInfo) throws java.io.IOException
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:
java.io.IOException- if an I/O error occurs while writing class files
-
evaluateNodes
public static void evaluateNodes(Node.Nodes nodes, SmapStratum s, java.util.HashMap<java.lang.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
public static SmapStratum loadSmap(java.lang.String className, java.lang.ClassLoader cl)
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
-
-