org.apache.batik.bridge
Class DefaultScriptSecurity

java.lang.Object
  extended by org.apache.batik.bridge.DefaultScriptSecurity
All Implemented Interfaces:
ScriptSecurity

public class DefaultScriptSecurity
extends Object
implements ScriptSecurity

Default implementation for the ScriptSecurity interface. It allows all types of scripts to be loaded, but only if they come from the same server as the document they are included into.


Field Summary
static String DATA_PROTOCOL
           
static String ERROR_CANNOT_ACCESS_DOCUMENT_URL
          Message when trying to load a script file and the Document does not have a URL
static String ERROR_SCRIPT_FROM_DIFFERENT_URL
          Message when trying to load a script file from a server different than the one of the document.
protected  SecurityException se
          The exception is built in the constructor and thrown if not null and the checkLoadScript method is called.
 
Constructor Summary
DefaultScriptSecurity(String scriptType, ParsedURL scriptURL, ParsedURL docURL)
           
 
Method Summary
 void checkLoadScript()
          Controls whether the script should be loaded or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_PROTOCOL

public static final String DATA_PROTOCOL
See Also:
Constant Field Values

ERROR_CANNOT_ACCESS_DOCUMENT_URL

public static final String ERROR_CANNOT_ACCESS_DOCUMENT_URL
Message when trying to load a script file and the Document does not have a URL

See Also:
Constant Field Values

ERROR_SCRIPT_FROM_DIFFERENT_URL

public static final String ERROR_SCRIPT_FROM_DIFFERENT_URL
Message when trying to load a script file from a server different than the one of the document.

See Also:
Constant Field Values

se

protected SecurityException se
The exception is built in the constructor and thrown if not null and the checkLoadScript method is called.

Constructor Detail

DefaultScriptSecurity

public DefaultScriptSecurity(String scriptType,
                             ParsedURL scriptURL,
                             ParsedURL docURL)
Parameters:
scriptType - type of script, as found in the type attribute of the <script> element.
scriptURL - url for the script, as defined in the script's xlink:href attribute. If that attribute was empty, then this parameter should be null
docURL - url for the document into which the script was found.
Method Detail

checkLoadScript

public void checkLoadScript()
Controls whether the script should be loaded or not.

Specified by:
checkLoadScript in interface ScriptSecurity
Throws:
SecurityException - if the script should not be loaded.


Copyright © 2008 Apache Software Foundation. All Rights Reserved.