private static final Map parseToTagsAndFunctions( ServletContext ctx, TldLocation tldLocation, ObjectWrapper objectWrapper) throws IOException, SAXException { final TldParserForTaglibBuilding tldParser = new TldParserForTaglibBuilding(objectWrapper); InputStream in = tldLocation.getInputStream(); try { parseXml(in, tldLocation.getXmlSystemId(), tldParser); } finally { in.close(); } EventForwarding eventForwarding = EventForwarding.getInstance(ctx); if (eventForwarding != null) { eventForwarding.addListeners(tldParser.getListeners()); } else if (tldParser.getListeners().size() > 0) { throw new TldParsingSAXException( "Event listeners specified in the TLD could not be " + " registered since the web application doesn't have a" + " listener of class " + EventForwarding.class.getName() + ". To remedy this, add this element to web.xml:\n" + "| <listener>\n" + "| <listener-class>" + EventForwarding.class.getName() + "</listener-class>\n" + "| </listener>", null); } return tldParser.getTagsAndFunctions(); } }
private static final Map parseToTagsAndFunctions( ServletContext ctx, TldLocation tldLocation, ObjectWrapper objectWrapper) throws IOException, SAXException { final TldParserForTaglibBuilding tldParser = new TldParserForTaglibBuilding(objectWrapper); InputStream in = tldLocation.getInputStream(); try { parseXml(in, tldLocation.getXmlSystemId(), tldParser); } finally { in.close(); } EventForwarding eventForwarding = EventForwarding.getInstance(ctx); if (eventForwarding != null) { eventForwarding.addListeners(tldParser.getListeners()); } else if (tldParser.getListeners().size() > 0) { throw new TldParsingSAXException( "Event listeners specified in the TLD could not be " + " registered since the web application doesn't have a" + " listener of class " + EventForwarding.class.getName() + ". To remedy this, add this element to web.xml:\n" + "| <listener>\n" + "| <listener-class>" + EventForwarding.class.getName() + "</listener-class>\n" + "| </listener>", null); } return tldParser.getTagsAndFunctions(); } }
private static final Map parseToTagsAndFunctions( ServletContext ctx, TldLocation tldLocation, ObjectWrapper objectWrapper) throws IOException, SAXException { final TldParserForTaglibBuilding tldParser = new TldParserForTaglibBuilding(objectWrapper); InputStream in = tldLocation.getInputStream(); try { parseXml(in, tldLocation.getXmlSystemId(), tldParser); } finally { in.close(); } EventForwarding eventForwarding = EventForwarding.getInstance(ctx); if (eventForwarding != null) { eventForwarding.addListeners(tldParser.getListeners()); } else if (tldParser.getListeners().size() > 0) { throw new TldParsingSAXException( "Event listeners specified in the TLD could not be " + " registered since the web application doesn't have a" + " listener of class " + EventForwarding.class.getName() + ". To remedy this, add this element to web.xml:\n" + "| <listener>\n" + "| <listener-class>" + EventForwarding.class.getName() + "</listener-class>\n" + "| </listener>", null); } return tldParser.getTagsAndFunctions(); } }
/** * Use this overload only if you already have the {@link InputStream} for some reason, otherwise use * {@link #addTldLocationFromTld(TldLocation)}. * * @param reusedIn * The stream that we already had (so we don't have to open a new one from the {@code tldLocation}). */ private void addTldLocationFromTld(InputStream reusedIn, TldLocation tldLocation) throws SAXException, IOException { String taglibUri; try { taglibUri = getTaglibUriFromTld(reusedIn, tldLocation.getXmlSystemId()); } catch (SAXException e) { LOG.error("Error while parsing TLD; skipping: " + tldLocation, e); synchronized (failedTldLocations) { failedTldLocations.add(tldLocation.toString()); } taglibUri = null; } if (taglibUri != null) { addTldLocation(tldLocation, taglibUri); } }
/** * Use this overload only if you already have the {@link InputStream} for some reason, otherwise use * {@link #addTldLocationFromTld(TldLocation)}. * * @param reusedIn * The stream that we already had (so we don't have to open a new one from the {@code tldLocation}). */ private void addTldLocationFromTld(InputStream reusedIn, TldLocation tldLocation) throws SAXException, IOException { String taglibUri; try { taglibUri = getTaglibUriFromTld(reusedIn, tldLocation.getXmlSystemId()); } catch (SAXException e) { LOG.error("Error while parsing TLD; skipping: " + tldLocation, e); synchronized (failedTldLocations) { failedTldLocations.add(tldLocation.toString()); } taglibUri = null; } if (taglibUri != null) { addTldLocation(tldLocation, taglibUri); } }
/** * Adds the TLD location mapping from the TLD itself. */ private void addTldLocationFromTld(TldLocation tldLocation) throws IOException, SAXException { InputStream in = tldLocation.getInputStream(); try { addTldLocationFromTld(in, tldLocation); } finally { in.close(); } }
/** * Adds the TLD location mapping from the TLD itself. */ private void addTldLocationFromTld(TldLocation tldLocation) throws IOException, SAXException { InputStream in = tldLocation.getInputStream(); try { addTldLocationFromTld(in, tldLocation); } finally { in.close(); } }
/** * Use this overload only if you already have the {@link InputStream} for some reason, otherwise use * {@link #addTldLocationFromTld(TldLocation)}. * * @param reusedIn * The stream that we already had (so we don't have to open a new one from the {@code tldLocation}). */ private void addTldLocationFromTld(InputStream reusedIn, TldLocation tldLocation) throws SAXException, IOException { String taglibUri; try { taglibUri = getTaglibUriFromTld(reusedIn, tldLocation.getXmlSystemId()); } catch (SAXException e) { LOG.error("Error while parsing TLD; skipping: " + tldLocation, e); synchronized (failedTldLocations) { failedTldLocations.add(tldLocation.toString()); } taglibUri = null; } if (taglibUri != null) { addTldLocation(tldLocation, taglibUri); } }
/** * Adds the TLD location mapping from the TLD itself. */ private void addTldLocationFromTld(TldLocation tldLocation) throws IOException, SAXException { InputStream in = tldLocation.getInputStream(); try { addTldLocationFromTld(in, tldLocation); } finally { in.close(); } }