1 18 package org.apache.batik.bridge; 19 20 import org.apache.batik.util.ParsedURL; 21 22 31 public class EmbededScriptSecurity implements ScriptSecurity { 32 public static final String DATA_PROTOCOL = "data"; 33 34 38 public static final String ERROR_CANNOT_ACCESS_DOCUMENT_URL 39 = "DefaultScriptSecurity.error.cannot.access.document.url"; 40 41 45 public static final String ERROR_SCRIPT_NOT_EMBEDED 46 = "EmbededScriptSecurity.error.script.not.embeded"; 47 48 52 protected SecurityException se; 53 54 59 public void checkLoadScript(){ 60 if (se != null) { 61 throw se; 62 } 63 } 64 65 75 public EmbededScriptSecurity(String scriptType, 76 ParsedURL scriptURL, 77 ParsedURL docURL){ 78 if (docURL == null) { 81 se = new SecurityException 82 (Messages.formatMessage(ERROR_CANNOT_ACCESS_DOCUMENT_URL, 83 new Object []{scriptURL})); 84 } else { 85 if ( !docURL.equals(scriptURL) 86 && 87 (scriptURL == null 88 || 89 !DATA_PROTOCOL.equals(scriptURL.getProtocol()) )) { 90 se = new SecurityException 91 (Messages.formatMessage(ERROR_SCRIPT_NOT_EMBEDED, 92 new Object []{scriptURL})); 93 } 94 } 95 } 96 } 97 98 99 100 | Popular Tags |