📄 httpunitoptions.java
字号:
* If true, text matches in methods such as {@link HTMLSegment#getLinkWith} are * case insensitive. The default is true (matches ignore case). **/ public static boolean getMatchesIgnoreCase() { return _matchesIgnoreCase; } /** * If true, text matches in methods such as {@link HTMLSegment#getLinkWith} are * case insensitive. The default is true (matches ignore case). **/ public static void setMatchesIgnoreCase( boolean ignoreCase ) { _matchesIgnoreCase = ignoreCase; } /** * Returns true if HTTP headers are to be dumped to system output. **/ public static boolean isLoggingHttpHeaders() { return _loggingHttpHeaders; } /** * If true, tells HttpUnit to log HTTP headers to system output. The default is false. **/ public static void setLoggingHttpHeaders( boolean enabled ) { _loggingHttpHeaders = enabled; } /** * Returns true if HttpUnit should automatically follow page redirect requests (status 3xx). * By default, this is true. * @deprecated as of 1.5.3, use ClientProperties#isAutoRedirect(); **/ public static boolean getAutoRedirect() { return ClientProperties.getDefaultProperties().isAutoRedirect(); } /** * Determines whether HttpUnit should automatically follow page redirect requests (status 3xx). * By default, this is true in order to simulate normal browser operation. * @deprecated as of 1.5.3, use ClientProperties#setAutoRedirect(); **/ public static void setAutoRedirect( boolean autoRedirect ) { ClientProperties.getDefaultProperties().setAutoRedirect( autoRedirect ); } /** * Returns the delay, in milliseconds, before a redirect request is issues. **/ public static int getRedirectDelay() { return _redirectDelay; } /** * Sets the delay, in milliseconds, before a redirect request is issued. This may be necessary if the server * under some cases where the server performs asynchronous processing which must be completed before the * new request can be handled properly, and is taking advantage of slower processing by most user agents. It * almost always indicates an error in the server design, and therefore the default delay is zero. **/ public static void setRedirectDelay( int delayInMilliseconds ) { _redirectDelay = delayInMilliseconds; } /** * Returns true if HttpUnit should automatically follow page refresh requests. * By default, this is false, so that programs can verify the redirect page presented * to users before the browser switches to the new page. * @deprecated as of 1.5.3, use ClientProperties#isAutoRefresh(); **/ public static boolean getAutoRefresh() { return ClientProperties.getDefaultProperties().isAutoRefresh(); } /** * Specifies whether HttpUnit should automatically follow page refresh requests. * By default, this is false, so that programs can verify the redirect page presented * to users before the browser switches to the new page. Setting this to true can * cause an infinite loop on pages that refresh themselves. * @deprecated as of 1.5.3, use ClientProperties#setAutoRefresh(); **/ public static void setAutoRefresh( boolean autoRefresh ) { ClientProperties.getDefaultProperties().setAutoRefresh( autoRefresh ); } /** * Remove an Html error listener. * @deprecated as of 1.5.2, use HTMLParserfactory#removeHTMLParserListener **/ public static void removeHtmlErrorListener(HTMLParserListener el) { HTMLParserFactory.removeHTMLParserListener( el ); } /** * Add an Html error listener. * @deprecated as of 1.5.2, use HTMLParserfactory#addHTMLParserListener **/ public static void addHtmlErrorListener(HTMLParserListener el) { HTMLParserFactory.addHTMLParserListener( el ); } /** * Get the list of Html Error Listeners * @deprecated as of 1.5.2, removed with no replacement **/ public static Vector getHtmlErrorListeners() { return null; } public static String getScriptEngineClassName() { return _scriptEngineClassName; } public static void setScriptEngineClassName( String scriptEngineClassName ) { if (_scriptEngineClassName == null || !_scriptEngineClassName.equals( scriptEngineClassName )) { _scriptingEngine = null; } _scriptEngineClassName = scriptEngineClassName; } public static ScriptingEngineFactory getScriptingEngine() { if (_scriptingEngine == null) { try { Class factoryClass = Class.forName( _scriptEngineClassName ); final ScriptingEngineFactory factory = (ScriptingEngineFactory) factoryClass.newInstance(); _scriptingEngine = factory.isEnabled() ? factory : NULL_SCRIPTING_ENGINE_FACTORY; _scriptingEngine.setThrowExceptionsOnError( _exceptionsThrownOnScriptError ); } catch (ClassNotFoundException e) { disableScripting( e, "Unable to find scripting engine factory class " ); } catch (InstantiationException e) { disableScripting( e, "Unable to instantiate scripting engine factory class " ); } catch (IllegalAccessException e) { disableScripting( e, "Unable to create scripting engine factory class " ); } } return _scriptingEngine; } public static void setScriptingEnabled( boolean scriptingEnabled ) { if (scriptingEnabled != _scriptingEnabled) { _scriptingEngine = scriptingEnabled ? null : NULL_SCRIPTING_ENGINE_FACTORY; } _scriptingEnabled = scriptingEnabled; } public static boolean isScriptingEnabled() { return _scriptingEnabled; } /** * Determines whether script errors result in exceptions or warning messages. */ public static void setExceptionsThrownOnScriptError( boolean throwExceptions ) { _exceptionsThrownOnScriptError = throwExceptions; getScriptingEngine().setThrowExceptionsOnError( throwExceptions ); } /** * Returns true if script errors cause exceptions to be thrown. */ public static boolean getExceptionsThrownOnScriptError() { return _exceptionsThrownOnScriptError; } /** * Returns the accumulated script error messages encountered. Error messages are accumulated only * if 'throwExceptionsOnError' is disabled. */ public static String[] getScriptErrorMessages() { return getScriptingEngine().getErrorMessages(); } /** * Clears the accumulated script error messages. */ public static void clearScriptErrorMessages() { getScriptingEngine().clearErrorMessages(); } private static void disableScripting( Exception e, String errorMessage ) { System.err.println( errorMessage + _scriptEngineClassName ); System.err.println( "" + e ); System.err.println( "JavaScript execution disabled"); _scriptingEngine = NULL_SCRIPTING_ENGINE_FACTORY; }//--------------------------------- private members -------------------------------------- private static final String DEFAULT_CONTENT_TYPE = "text/html"; private static final ScriptingEngineFactory NULL_SCRIPTING_ENGINE_FACTORY = new ScriptingEngineFactory() { public boolean isEnabled() { return false; } public void associate( WebResponse response ) {} public void load( WebResponse response ) {} public void setThrowExceptionsOnError( boolean throwExceptions ) {} public boolean isThrowExceptionsOnError() { return false; } public String[] getErrorMessages() { return new String[ 0 ]; } public void clearErrorMessages() {} }; private static boolean _exceptionsOnErrorStatus = true; private static boolean _parameterValuesValidated = true; private static boolean _imagesTreatedAsAltText; private static boolean _loggingHttpHeaders; private static boolean _matchesIgnoreCase = true; private static boolean _postIncludesCharset = false; private static boolean _checkContentLength = false; private static int _redirectDelay; private static String _characterSet = HttpUnitUtils.DEFAULT_CHARACTER_SET; private static String _contentType = DEFAULT_CONTENT_TYPE; private static String _scriptEngineClassName; private static ScriptingEngineFactory _scriptingEngine; private static boolean _scriptingEnabled = true; private static boolean _exceptionsThrownOnScriptError = true; static { reset(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -