class

Analyzer::Java::Jsp

Inherits Analyzer < FileHelper < Reference < Object

Constants

AT_WEBSERVLET_RE = Regex.union("@WebServlet")
HTTPSERVLET_RE = Regex.union("HttpServlet")
INTERNAL_ATTRIBUTE_PREFIXES = ["javax.servlet.", "jakarta.servlet.", "javax.faces.", "jakarta.faces.", "org.springframework.", "org.apache.", "org.eclipse.jetty.", "org.glassfish.", "com.sun.", "weblogic.", "io.undertow."]

Container- and framework-managed request attributes. These are populated by the servlet engine, filters or the MVC layer — never by user input — so request.getAttribute("javax.servlet....") must not be reported as a request parameter.

SERVLET_DO_METHOD_PATTERNS = {"Get" => "GET", "Post" => "POST", "Put" => "PUT", "Delete" => "DELETE", "Patch" => "PATCH", "Head" => "HEAD", "Options" => "OPTIONS"}.map do |suffix, method| {method, /\bvoid\s+do#{suffix}\s*\(([^)]*)\)\s*(?:throws[^{]+)?\{/m} end

Crystal recompiles an interpolated regex literal on every evaluation (a full PCRE2 JIT compile). The doGet/doPost/... probe set is fixed, so precompile it once at load time.

SERVLET_MARKERS_RE = Regex.union("@WebServlet", "HttpServlet")

Neither branch can hold without one of these two literals, so the union is an exact pre-gate — and it replaces two String#includes? scans of every .java file in the tree with one precompiled pass.

WEBAPP_ROOT_MARKERS = ["src/main/webapp/", "src/main/resources/META-INF/resources/", "WebContent/", "WebRoot/"]

A JSP is served relative to the WEB application root, not the repo root. src/main/webapp/jsp/index.jsp is reachable at /jsp/index.jsp, so strip the build-layout webapp-root prefix; otherwise the whole source path (/libraries-otel/.../src/main/webapp/index.jsp) leaked into the URL.

Class methods

tech_name
Source

Instance methods

allow_patterns
Source
analyze
Source
extract_params(content : String) : Array(Param)
Source
internal_servlet_attribute?(name : String) : Bool
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source

Nested types