All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.globallink.api.pss.rewriters.CssRewriter Maven / Gradle / Ivy

Go to download

The newest version!
package com.globallink.api.pss.rewriters;

import java.util.ArrayList;
import java.util.List;

import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.globallink.api.pss.DownloadedFileInfo;
import com.globallink.api.pss.DownloadedFileInfo.Types;

public class CssRewriter implements IFileTagRewriter {
    public List RewriteLinks(Document document)
    {
        List fileInfos = new ArrayList();
        Elements els = document.select("link[href]");
        int i=0;
        for(Element el : els){
            i++;
        	String sourceUrl = el.attr("abs:href");
                DownloadedFileInfo fileInfo = new DownloadedFileInfo(sourceUrl, Types.CSS, i);
                el.attr("href", fileInfo.ResolvedFilePath);
                fileInfos.add(fileInfo);
        }

        return fileInfos;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy