我想在我的項目中使用OWASP ESAPI。但問題是owasp文檔太複雜了。我試圖從esapi使用驗證,但即使沒有錯誤,我也無法得到結果。使用esapi時出錯
import org.owasp.esapi.ESAPI;
import org.owasp.esapi.Validator;
public void security(String s) {
System.out.println("connect 1");
Validator instance = ESAPI.validator();
System.out.println("connect 2");
System.out.println(instance.isValidInput("test", "[email protected]", "Email", 100, false));
}
這裏的結果,如果我嘗試運行3次:
connect 1
Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Not found in 'org.owasp.esapi.resources' directory or file not readable: C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\bin\ESAPI.properties
Not found in SystemResource Directory/resourceDirectory: .esapi\ESAPI.properties
Found in 'user.home' directory: C:\Users\xxxx\esapi\ESAPI.properties
Loaded 'ESAPI.properties' properties file
Attempting to load validation.properties via file I/O.
Attempting to load validation.properties as resource file via file I/O.
Not found in 'org.owasp.esapi.resources' directory or file not readable: C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\bin\validation.properties
Not found in SystemResource Directory/resourceDirectory: .esapi\validation.properties
Found in 'user.home' directory: C:\Users\xxxx\esapi\validation.properties
Loaded 'validation.properties' properties file
connect 1
connect 1
,你可以看到有沒有錯誤和性能正確加載。我的問題是爲什麼它停在那裏。爲什麼'連接2'不打印?以及爲什麼不打印instance.isValidInput的結果?
該文件的更好的鏈接:https://www.owasp.org/images/4/4c/JavaEE-ESAPI_2.0a_install.doc – antonyh