/** * Test for a compatible URL. * * @param url URL * @return Success code */ public static boolean isCompatibleURLStatic(ParsedURL url) { return url.getProtocol().equals(INTERNAL_PROTOCOL); }
/** * Test for a compatible URL. * * @param url URL * @return Success code */ public static boolean isCompatibleURLStatic(ParsedURL url) { return url.getProtocol().equals(INTERNAL_PROTOCOL); }
/** * @param externalResourceURL url for the externalResource, as defined in * the externalResource's xlink:href attribute. If that * attribute was empty, then this parameter should * be null */ public EmbededExternalResourceSecurity(ParsedURL externalResourceURL){ if ( externalResourceURL == null || !DATA_PROTOCOL.equals(externalResourceURL.getProtocol()) ) { se = new SecurityException (Messages.formatMessage(ERROR_EXTERNAL_RESOURCE_NOT_EMBEDED, new Object[]{externalResourceURL})); } } }
/** * @param externalResourceURL url for the externalResource, as defined in * the externalResource's xlink:href attribute. If that * attribute was empty, then this parameter should * be null */ public EmbededExternalResourceSecurity(ParsedURL externalResourceURL){ if ( externalResourceURL == null || !DATA_PROTOCOL.equals(externalResourceURL.getProtocol()) ) { se = new SecurityException (Messages.formatMessage(ERROR_EXTERNAL_RESOURCE_NOT_EMBEDED, new Object[]{externalResourceURL})); } } }
/** * @param externalResourceURL url for the externalResource, as defined in * the externalResource's xlink:href attribute. If that * attribute was empty, then this parameter should * be null */ public EmbededExternalResourceSecurity(ParsedURL externalResourceURL){ if ( externalResourceURL == null || !DATA_PROTOCOL.equals(externalResourceURL.getProtocol()) ) { se = new SecurityException (Messages.formatMessage(ERROR_EXTERNAL_RESOURCE_NOT_EMBEDED, new Object[]{externalResourceURL})); } } }
/** * Factory method to construct an appropriate subclass of ParsedURLData * @param urlStr the string to parse. */ public static ParsedURLData parseURL(String urlStr) { if (urlStr != null && !urlStr.contains(":") && !urlStr.startsWith("#")) { // an URL needs a protocol; default to file:// if none set urlStr = "file:" + urlStr; } ParsedURLProtocolHandler handler = getHandler(getProtocol(urlStr)); return handler.parseURL(urlStr); }
/** * Factory method to construct an appropriate subclass of ParsedURLData * @param urlStr the string to parse. */ public static ParsedURLData parseURL(String urlStr) { if (urlStr != null && !urlStr.contains(":") && !urlStr.startsWith("#")) { // an URL needs a protocol; default to file:// if none set urlStr = "file:" + urlStr; } ParsedURLProtocolHandler handler = getHandler(getProtocol(urlStr)); return handler.parseURL(urlStr); }
/** * Factory method to construct an appropriate subclass of ParsedURLData * @param urlStr the string to parse. */ public static ParsedURLData parseURL(String urlStr) { if (urlStr != null && !urlStr.contains(":") && !urlStr.startsWith("#")) { // an URL needs a protocol; default to file:// if none set urlStr = "file:" + urlStr; } ParsedURLProtocolHandler handler = getHandler(getProtocol(urlStr)); return handler.parseURL(urlStr); }
/** * Factory method to construct an appropriate subclass of ParsedURLData, * for a sub url. * @param baseURL The base ParsedURL to parse. * @param urlStr the sub URL string to parse. */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { if (baseURL == null) return parseURL(urlStr); String protocol = getProtocol(urlStr); if (protocol == null) protocol = baseURL.getProtocol(); ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } }
/** * Factory method to construct an appropriate subclass of ParsedURLData, * for a sub url. * @param baseURL The base ParsedURL to parse. * @param urlStr the sub URL string to parse. */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { if (baseURL == null) return parseURL(urlStr); String protocol = getProtocol(urlStr); if (protocol == null) protocol = baseURL.getProtocol(); ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } }
/** * Factory method to construct an appropriate subclass of ParsedURLData, * for a sub url. * @param baseURL The base ParsedURL to parse. * @param urlStr the sub URL string to parse. */ public static ParsedURLData parseURL(ParsedURL baseURL, String urlStr) { if (baseURL == null) return parseURL(urlStr); String protocol = getProtocol(urlStr); if (protocol == null) protocol = baseURL.getProtocol(); ParsedURLProtocolHandler handler = getHandler(protocol); return handler.parseURL(baseURL, urlStr); } }
(scriptURL == null || !DATA_PROTOCOL.equals(scriptURL.getProtocol()) )) { se = new SecurityException (Messages.formatMessage(ERROR_SCRIPT_NOT_EMBEDED,
!DATA_PROTOCOL.equals(externalResourceURL.getProtocol()) ) { se = new SecurityException (Messages.formatMessage(ERROR_EXTERNAL_RESOURCE_FROM_DIFFERENT_URL,
(scriptURL == null || !DATA_PROTOCOL.equals(scriptURL.getProtocol()) )) { se = new SecurityException (Messages.formatMessage(ERROR_SCRIPT_NOT_EMBEDED,
(scriptURL == null || !DATA_PROTOCOL.equals(scriptURL.getProtocol()) )) { se = new SecurityException (Messages.formatMessage(ERROR_SCRIPT_NOT_EMBEDED,
@Override public Node cloneNode(Document doc, Node eold) { Node enew = null; if(eold instanceof Element) { Element e = (Element) eold; if(e.getTagName().equals(SVGConstants.SVG_IMAGE_TAG)) { String url = e.getAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE); ParsedURL urldata = new ParsedURL(url); if(ThumbnailRegistryEntry.isCompatibleURLStatic(urldata)) { enew = inlineThumbnail(doc, urldata, eold); } else if("file".equals(urldata.getProtocol())) { enew = inlineExternal(doc, urldata, eold); } } } if(enew != null) { return enew; } return super.cloneNode(doc, eold); }
@Override public Node cloneNode(Document doc, Node eold) { Node enew = null; if(eold instanceof Element) { Element e = (Element) eold; if(e.getTagName().equals(SVGConstants.SVG_IMAGE_TAG)) { String url = e.getAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE); ParsedURL urldata = new ParsedURL(url); if(ThumbnailRegistryEntry.isCompatibleURLStatic(urldata)) { enew = inlineThumbnail(doc, urldata, eold); } else if("file".equals(urldata.getProtocol())) { enew = inlineExternal(doc, urldata, eold); } } } if(enew != null) { return enew; } return super.cloneNode(doc, eold); }
!DATA_PROTOCOL.equals(externalResourceURL.getProtocol()) ) { se = new SecurityException (Messages.formatMessage(ERROR_EXTERNAL_RESOURCE_FROM_DIFFERENT_URL,
!DATA_PROTOCOL.equals(externalResourceURL.getProtocol()) ) { se = new SecurityException (Messages.formatMessage(ERROR_EXTERNAL_RESOURCE_FROM_DIFFERENT_URL,
ParsedURL purl = new ParsedURL(uri); if ("file".equals(purl.getProtocol())) { // NOI18N