Factor isGetServletMethod into the servlet library

This commit is contained in:
luchua-bc
2021-01-04 16:14:13 +00:00
parent ffe9d4a310
commit 496db4b42f
2 changed files with 12 additions and 8 deletions

View File

@@ -322,3 +322,12 @@ class ServletWebXMLListenerType extends RefType {
// - `HttpSessionBindingListener`
}
}
/** Holds if `c` is a call to some override of methods of `HttpServlet`, for example `doGet` or `doPost`. */
predicate isServletMethod(Callable c, string methodName) {
c.getDeclaringType() instanceof ServletClass and
c.getNumberOfParameters() = 2 and
c.getParameter(0).getType() instanceof ServletRequest and
c.getParameter(1).getType() instanceof ServletResponse and
c.getName() = methodName
}