code: public static void addFilter(Document doc, Element root) {
      Element filter = doc.createElement("filter");
      Element filterName = doc.createElement("filter-name");
      filterName.appendChild(doc.createTextNode("ShiroFilter"));
      filter.appendChild(filterName);
      Element filterClass = doc.createElement("filter-class");
      filterClass.appendChild(doc
          .createTextNode("org.apache.shiro.web.servlet.ShiroFilter"));
      filter.appendChild(filterClass);
  
      addRelativeTo(root, filter, "filter", true);
    }
docs: Adds the shiro filter to a web.xml file.
  @param doc The xml DOM document to create the new xml elements with.
  @param root The xml Element node to add the filter to.