import java /** * Holds if any `web.xml` files are included in this snapshot. */ predicate isWebXmlIncluded() { exists(WebXmlFile webXml) } /** DEPRECATED: Alias for isWebXmlIncluded */ deprecated predicate isWebXMLIncluded = isWebXmlIncluded/0; /** * A deployment descriptor file, typically called `web.xml`. */ class WebXmlFile extends XMLFile { WebXmlFile() { count(XMLElement e | e = this.getAChild()) = 1 and this.getAChild().getName() = "web-app" } /** * Gets the value of the context parameter with the given name. */ string getContextParamValue(string name) { exists(WebContextParameter parameter | // Find a web context parameter in the same file and ... parameter.getFile() = this and // ... with the right name. name = parameter.getParamName().getValue() and result = parameter.getParamValue().getValue() ) } } /** DEPRECATED: Alias for WebXmlFile */ deprecated class WebXMLFile = WebXmlFile; /** * An XML element in a `WebXMLFile`. */ class WebXmlElement extends XMLElement { WebXmlElement() { this.getFile() instanceof WebXmlFile } /** * Gets the value for this element, with leading and trailing whitespace trimmed. */ string getValue() { result = this.allCharactersString().trim() } } /** DEPRECATED: Alias for WebXmlElement */ deprecated class WebXMLElement = WebXmlElement; /** * A `` element in a `web.xml` file. */ class WebContextParameter extends WebXmlElement { WebContextParameter() { this.getName() = "context-param" } /** * Gets the `` element of this ``. */ WebContextParamName getParamName() { result = this.getAChild() } /** * Gets the `` element of this ``. */ WebContextParamValue getParamValue() { result = this.getAChild() } } /** * A `` element in a `web.xml` file. */ class WebContextParamName extends WebXmlElement { WebContextParamName() { this.getName() = "param-name" } } /** * A `` element in a `web.xml` file. */ class WebContextParamValue extends WebXmlElement { WebContextParamValue() { this.getName() = "param-value" } } /** * A `` element in a `web.xml` file. */ class WebFilter extends WebXmlElement { WebFilter() { this.getName() = "filter" } } /** * A `` element in a `web.xml` file, nested under a `` element. */ class WebFilterClass extends WebXmlElement { WebFilterClass() { this.getName() = "filter-class" and this.getParent() instanceof WebFilter } Class getClass() { result.getQualifiedName() = this.getValue() } } /** * A `` element in a `web.xml` file. */ class WebServlet extends WebXmlElement { WebServlet() { this.getName() = "servlet" } } /** * A `` element in a `web.xml` file, nested under a `` element. */ class WebServletClass extends WebXmlElement { WebServletClass() { this.getName() = "servlet-class" and this.getParent() instanceof WebServlet } Class getClass() { result.getQualifiedName() = this.getValue() } } /** * A `` element in a `web.xml` file. */ class WebListener extends WebXmlElement { WebListener() { this.getName() = "listener" } } /** * A `` element in a `web.xml` file, nested under a `` element. */ class WebListenerClass extends WebXmlElement { WebListenerClass() { this.getName() = "listener-class" and this.getParent() instanceof WebListener } /** * Gets the `Class` instance associated with this element. */ Class getClass() { result.getQualifiedName() = this.getValue() } } /** * An `` element in a `web.xml` file. */ class WebErrorPage extends WebXmlElement { WebErrorPage() { this.getName() = "error-page" } /** * Gets the `` element of this ``. */ WebErrorPageType getPageType() { result = this.getAChild() } /** * Gets the `` element of this ``. */ WebErrorPageLocation getPageLocation() { result = this.getAChild() } } /** * An `` element in a `web.xml` file, nested under an `` element. */ class WebErrorPageType extends WebXmlElement { WebErrorPageType() { this.getName() = "exception-type" and this.getParent() instanceof WebErrorPage } } /** * A `` element in a `web.xml` file, nested under an `` element. */ class WebErrorPageLocation extends WebXmlElement { WebErrorPageLocation() { this.getName() = "location" and this.getParent() instanceof WebErrorPage } }