1 19 20 package org.netbeans.modules.web.project; 21 22 import java.io.File ; 23 import java.net.MalformedURLException ; 24 import java.net.URL ; 25 import org.openide.filesystems.FileUtil; 26 27 33 public class WebProjectUtil { 34 private WebProjectUtil() { 35 } 36 37 47 public static URL getRootURL (File root, String offset) throws MalformedURLException { 48 URL url = root.toURI().toURL(); 49 if (FileUtil.isArchiveFile(url)) { 50 url = FileUtil.getArchiveRoot(url); 51 } else if (!root.exists()) { 52 url = new URL (url.toExternalForm() + "/"); } 54 if (offset != null) { 55 assert offset.endsWith("/"); url = new URL (url.toExternalForm() + offset); } 58 return url; 59 } 60 } 61 | Popular Tags |