com.globallink.api.pss.rewriters.CssRewriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of globallink-connect-api Show documentation
Show all versions of globallink-connect-api Show documentation
GlobalLink Connect Java is a library to connect your system to GlobalLink Project Director SOAP API.
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;
}
}