// Thanks for Giordano Sassaroli <*****@*****.**> (09/03/03) private boolean isURL(String referenceUrl, String url) { if (referenceUrl == null || url == null) return false; boolean ret = url.equals(referenceUrl); if (ret == true) return true; String relativeRefUrl = HTTP.toRelativeURL(referenceUrl, false); ret = url.equals(relativeRefUrl); if (ret == true) return true; return false; }
private Node getSCPDNode() { ServiceData data = getServiceData(); Node scpdNode = data.getSCPDNode(); if (scpdNode != null) return scpdNode; // Thanks for Jaap (Sep 18, 2010) Device rootDev = getRootDevice(); if (rootDev == null) return null; String scpdURLStr = getSCPDURL(); // Thanks for Robin V. (Sep 18, 2010) String rootDevPath = rootDev.getDescriptionFilePath(); if (rootDevPath != null) { File f; f = new File(rootDevPath.concat(scpdURLStr)); if (f.exists()) { try { scpdNode = getSCPDNode(f); } catch (ParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (scpdNode != null) { data.setSCPDNode(scpdNode); return scpdNode; } } } try { URL scpdUrl = new URL(rootDev.getAbsoluteURL(scpdURLStr)); scpdNode = getSCPDNode(scpdUrl); if (scpdNode != null) { data.setSCPDNode(scpdNode); return scpdNode; } } catch (Exception e) { } // ms777 I found this necessary to get the correct scpdUrl on Windows / PC try { URL urlLoc = new URL(rootDev.getLocation()); URL scpdUrl = new URL(urlLoc.getProtocol(), urlLoc.getHost(), urlLoc.getPort(), scpdURLStr); scpdNode = getSCPDNode(scpdUrl); if (scpdNode != null) { data.setSCPDNode(scpdNode); return scpdNode; } } catch (Exception e) { } // ms777 end String newScpdURLStr = rootDev.getDescriptionFilePath() + HTTP.toRelativeURL(scpdURLStr); try { scpdNode = getSCPDNode(new File(newScpdURLStr)); return scpdNode; } catch (Exception e) { Debug.warning(e); } return null; }