List of usage examples for org.jsoup.nodes Attribute html
public String html()
From source file:com.iorga.iraj.servlet.AgglomeratorServlet.java
private long searchAndAppendAfter(final ServletConfig config, final Element agglomerateElement, final String scriptSrc, final String pathPrefix, final String pathSuffix, final String urlAttribute, long lastModified) throws MalformedURLException, IOException, URISyntaxException { if (mode == Mode.DEVELOPMENT) { // add a watch for that directory final Path path = Paths.get(config.getServletContext().getRealPath(scriptSrc)); path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE); }/*w w w . j ava2 s . com*/ final Set<String> childrenPaths = config.getServletContext().getResourcePaths(scriptSrc); for (final String path : childrenPaths) { if (path.endsWith(pathSuffix)) { // add that JS final StringBuilder targetScript = new StringBuilder("<"); targetScript.append(agglomerateElement.tagName()); // copy all the origin attributes for (final Attribute attribute : agglomerateElement.attributes()) { final String key = attribute.getKey(); if (!ATTRIBUTE_NAME.equalsIgnoreCase(key) && !urlAttribute.equalsIgnoreCase(key) && !URL_ATTRIBUTE_ATTRIBUTE_NAME.equalsIgnoreCase(key)) { targetScript.append(" ").append(attribute.html()); } } // specify the src path final String childUrl = StringUtils.removeStart(path, pathPrefix); targetScript.append(" ").append(new Attribute(urlAttribute, childUrl).html()).append(" />"); agglomerateElement.after(targetScript.toString()); lastModified = Math.max( config.getServletContext().getResource(childUrl).openConnection().getLastModified(), lastModified); } else if (path.endsWith("/")) { // it's a directory, recurse search & append lastModified = Math.max(searchAndAppendAfter(config, agglomerateElement, path, pathPrefix, pathSuffix, urlAttribute, lastModified), lastModified); } } return lastModified; }