• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / httpunit / 755

14 Feb 2026 07:14PM UTC coverage: 80.526%. Remained the same
755

push

github

hazendaz
[ci] Fix badge

3213 of 4105 branches covered (78.27%)

Branch coverage included in aggregate %.

8245 of 10124 relevant lines covered (81.44%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.52
/src/main/java/com/meterware/httpunit/HttpUnitOptions.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2000-2026 Russell Gold
6
 * Copyright 2021-2000 hazendaz
7
 */
8
package com.meterware.httpunit;
9

10
import com.meterware.httpunit.parsing.HTMLParserFactory;
11
import com.meterware.httpunit.parsing.HTMLParserListener;
12
import com.meterware.httpunit.scripting.ScriptableDelegate;
13
import com.meterware.httpunit.scripting.ScriptingEngineFactory;
14
import com.meterware.httpunit.scripting.ScriptingHandler;
15

16
import java.lang.reflect.InvocationTargetException;
17
import java.nio.charset.StandardCharsets;
18
import java.util.HashSet;
19
import java.util.List;
20
import java.util.Set;
21

22
/**
23
 * A collection of global options to control HttpUnit's behavior.
24
 **/
25
public abstract class HttpUnitOptions {
×
26

27
    /** The Constant ORIGINAL_SCRIPTING_ENGINE_FACTORY. */
28
    public static final String ORIGINAL_SCRIPTING_ENGINE_FACTORY = "com.meterware.httpunit.javascript.JavaScriptEngineFactory";
29
    // comment out the scripting engine not to be used by allowing the appropriate number of asterisks in the comment on
30
    // the next line (1 or 2)
31
    /** The Constant DEFAULT_SCRIPT_ENGINE_FACTORY. */
32
    /**/
33
    public static final String DEFAULT_SCRIPT_ENGINE_FACTORY = ORIGINAL_SCRIPTING_ENGINE_FACTORY;
34
    /*
35
     * / public static final String DEFAULT_SCRIPT_ENGINE_FACTORY = NEW_SCRIPTING_ENGINE_FACTORY; /
36
     */
37

38
    /**
39
     * Resets all options to their default values.
40
     */
41
    public static void reset() {
42
        _exceptionsOnErrorStatus = true;
1✔
43
        _parameterValuesValidated = true;
1✔
44
        _imagesTreatedAsAltText = false;
1✔
45
        _loggingHttpHeaders = false;
1✔
46
        _matchesIgnoreCase = true;
1✔
47
        _checkContentLength = false;
1✔
48
        _redirectDelay = 0; // TODO move this to ClientProperties
1✔
49
        _characterSet = StandardCharsets.ISO_8859_1.name();
1✔
50
        _contentType = DEFAULT_CONTENT_TYPE;
1✔
51
        _postIncludesCharset = false;
1✔
52
        _exceptionsThrownOnScriptError = true;
1✔
53
        _customAttributes = null;
1✔
54
        _javaScriptOptimizationLevel = -1;
1✔
55
        _checkHtmlContentType = false;
1✔
56
        setScriptEngineClassName(DEFAULT_SCRIPT_ENGINE_FACTORY);
1✔
57
        setScriptingEnabled(true);
1✔
58
    }
1✔
59

60
    /**
61
     * Returns true if HttpUnit is accepting and saving cookies. The default is to accept them.
62
     *
63
     * @return true, if is accept cookies
64
     *
65
     * @deprecated as of 1.5.3, use ClientProperties#isAcceptCookies();
66
     */
67
    @Deprecated
68
    public static boolean isAcceptCookies() {
69
        return ClientProperties.getDefaultProperties().isAcceptCookies();
×
70
    }
71

72
    /**
73
     * Specifies whether HttpUnit should accept and send cookies.
74
     *
75
     * @param acceptCookies
76
     *            the new accept cookies
77
     *
78
     * @deprecated as of 1.5.3, use ClientProperties#setAcceptCookies();
79
     */
80
    @Deprecated
81
    public static void setAcceptCookies(boolean acceptCookies) {
82
        ClientProperties.getDefaultProperties().setAcceptCookies(acceptCookies);
×
83
    }
×
84

85
    /**
86
     * Returns true if any WebClient created will accept GZIP encoding of responses. The default is to accept GZIP
87
     * encoding.
88
     *
89
     * @return true, if is accept gzip
90
     *
91
     * @deprecated as of 1.5.3, use ClientProperties#isAcceptGzip();
92
     */
93
    @Deprecated
94
    public static boolean isAcceptGzip() {
95
        return ClientProperties.getDefaultProperties().isAcceptGzip();
×
96
    }
97

98
    /**
99
     * Specifies whether a WebClient will be initialized to accept GZIP encoded responses. The default is true.
100
     *
101
     * @param acceptGzip
102
     *            the new accept gzip
103
     *
104
     * @deprecated as of 1.5.3, use ClientProperties#setAcceptGzip();
105
     */
106
    @Deprecated
107
    public static void setAcceptGzip(boolean acceptGzip) {
108
        ClientProperties.getDefaultProperties().setAcceptGzip(acceptGzip);
×
109
    }
×
110

111
    /**
112
     * Resets the default character set to the HTTP default encoding.
113
     **/
114
    public static void resetDefaultCharacterSet() {
115
        _characterSet = StandardCharsets.ISO_8859_1.name();
×
116
    }
×
117

118
    /**
119
     * Resets the default content type to plain text.
120
     **/
121
    public static void resetDefaultContentType() {
122
        _contentType = DEFAULT_CONTENT_TYPE;
×
123
    }
×
124

125
    /**
126
     * Sets the default character set for pages which do not specify one and for requests created without HTML sources.
127
     * By default, HttpUnit uses the HTTP default encoding, ISO-8859-1.
128
     *
129
     * @param characterSet
130
     *            the new default character set
131
     */
132
    public static void setDefaultCharacterSet(String characterSet) {
133
        _characterSet = characterSet;
1✔
134
    }
1✔
135

136
    /**
137
     * Returns the character set to be used for pages which do not specify one.
138
     *
139
     * @return the default character set
140
     */
141
    public static String getDefaultCharacterSet() {
142
        return _characterSet;
1✔
143
    }
144

145
    /**
146
     * Returns true if HttpUnit will throw an exception when a message is only partially received. The default is to
147
     * avoid such checks.
148
     *
149
     * @return true, if is check content length
150
     */
151
    public static boolean isCheckContentLength() {
152
        return _checkContentLength;
1✔
153
    }
154

155
    /**
156
     * Specifies whether HttpUnit should throw an exception when the content length of a message does not match its
157
     * actual received length. Defaults to false.
158
     *
159
     * @param checkContentLength
160
     *            the new check content length
161
     */
162
    public static void setCheckContentLength(boolean checkContentLength) {
163
        _checkContentLength = checkContentLength;
1✔
164
    }
1✔
165

166
    /**
167
     * Determines whether a normal POST request will include the character set in the content-type header. The default
168
     * is to include it; however, some older servlet engines (most notably Tomcat 3.1) get confused when they see it.
169
     *
170
     * @param postIncludesCharset
171
     *            the new post includes charset
172
     */
173
    public static void setPostIncludesCharset(boolean postIncludesCharset) {
174
        _postIncludesCharset = postIncludesCharset;
×
175
    }
×
176

177
    /**
178
     * Returns true if POST requests should include the character set in the content-type header.
179
     *
180
     * @return true, if is post includes charset
181
     */
182
    public static boolean isPostIncludesCharset() {
183
        return _postIncludesCharset;
1✔
184
    }
185

186
    /**
187
     * Sets the default content type for pages which do not specify one.
188
     *
189
     * @param contentType
190
     *            the new default content type
191
     */
192
    public static void setDefaultContentType(String contentType) {
193
        _contentType = contentType;
×
194
    }
×
195

196
    /**
197
     * Returns the content type to be used for pages which do not specify one.
198
     *
199
     * @return the default content type
200
     */
201
    public static String getDefaultContentType() {
202
        return _contentType;
×
203
    }
204

205
    /**
206
     * Returns true if parser warnings are enabled.
207
     *
208
     * @return the parser warnings enabled
209
     *
210
     * @deprecated as of 1.5.2, use HTMLParserFactory#isParserWarningsEnabled
211
     */
212
    @Deprecated
213
    public static boolean getParserWarningsEnabled() {
214
        return HTMLParserFactory.isParserWarningsEnabled();
×
215
    }
216

217
    /**
218
     * If true, tells the parser to display warning messages. The default is false (warnings are not shown).
219
     *
220
     * @param enabled
221
     *            the new parser warnings enabled
222
     *
223
     * @deprecated as of 1.5.2, use HTMLParserFactory#setParserWarningsEnabled
224
     */
225
    @Deprecated
226
    public static void setParserWarningsEnabled(boolean enabled) {
227
        HTMLParserFactory.setParserWarningsEnabled(enabled);
×
228
    }
×
229

230
    /**
231
     * If true, WebClient.getResponse throws an exception when it receives an error status. Defaults to true.
232
     *
233
     * @param enabled
234
     *            the new exceptions thrown on error status
235
     */
236
    public static void setExceptionsThrownOnErrorStatus(boolean enabled) {
237
        _exceptionsOnErrorStatus = enabled;
1✔
238
    }
1✔
239

240
    /**
241
     * Returns true if WebClient.getResponse throws exceptions when detected an error status.
242
     *
243
     * @return the exceptions thrown on error status
244
     */
245
    public static boolean getExceptionsThrownOnErrorStatus() {
246
        return _exceptionsOnErrorStatus;
1✔
247
    }
248

249
    /**
250
     * Returns true if form parameter settings are checked.
251
     *
252
     * @return the parameter values validated
253
     *
254
     * @deprecated as of 1.6, use WebForm#newUnvalidatedRequest() to obtain a request without parameter validation.
255
     */
256
    @Deprecated
257
    public static boolean getParameterValuesValidated() {
258
        return _parameterValuesValidated;
1✔
259
    }
260

261
    /**
262
     * If true, tells HttpUnit to throw an exception on any attempt to set a form parameter to a value which could not
263
     * be set via the browser. The default is true (parameters are validated).<br>
264
     * <b>Note:</b> this only applies to a WebRequest created after this setting is changed. A request created with this
265
     * option disabled will not only not be checked for correctness, its parameter submission order will not be
266
     * guaranteed, and changing parameters will not trigger Javascript onChange / onClick events.
267
     *
268
     * @param validated
269
     *            the new parameter values validated
270
     *
271
     * @deprecated as of 1.6, use WebForm#newUnvalidatedRequest() to obtain a request without parameter validation.
272
     */
273
    @Deprecated
274
    public static void setParameterValuesValidated(boolean validated) {
275
        _parameterValuesValidated = validated;
1✔
276
    }
1✔
277

278
    /**
279
     * Returns true if images are treated as text, using their alt attributes.
280
     *
281
     * @return the images treated as alt text
282
     */
283
    public static boolean getImagesTreatedAsAltText() {
284
        return _imagesTreatedAsAltText;
1✔
285
    }
286

287
    /**
288
     * If true, tells HttpUnit to treat images with alt attributes as though they were the text value of that attribute
289
     * in all searches and displays. The default is false (image text is generally ignored).
290
     *
291
     * @param asText
292
     *            the new images treated as alt text
293
     */
294
    public static void setImagesTreatedAsAltText(boolean asText) {
295
        _imagesTreatedAsAltText = asText;
1✔
296
    }
1✔
297

298
    /**
299
     * If true, text matches in methods such as {@link HTMLSegment#getLinkWith} are case insensitive. The default is
300
     * true (matches ignore case).
301
     *
302
     * @return the matches ignore case
303
     */
304
    public static boolean getMatchesIgnoreCase() {
305
        return _matchesIgnoreCase;
1✔
306
    }
307

308
    /**
309
     * If true, text matches in methods such as {@link HTMLSegment#getLinkWith} are case insensitive. The default is
310
     * true (matches ignore case).
311
     *
312
     * @param ignoreCase
313
     *            the new matches ignore case
314
     */
315
    public static void setMatchesIgnoreCase(boolean ignoreCase) {
316
        _matchesIgnoreCase = ignoreCase;
×
317
    }
×
318

319
    /**
320
     * Returns true if HTTP headers are to be dumped to system output.
321
     *
322
     * @return true, if is logging http headers
323
     */
324
    public static boolean isLoggingHttpHeaders() {
325
        return _loggingHttpHeaders;
1✔
326
    }
327

328
    /**
329
     * If true, tells HttpUnit to log HTTP headers to system output. The default is false.
330
     *
331
     * @param enabled
332
     *            the new logging http headers
333
     */
334
    public static void setLoggingHttpHeaders(boolean enabled) {
335
        _loggingHttpHeaders = enabled;
1✔
336
    }
1✔
337

338
    /**
339
     * Returns true if HttpUnit throws an exception when attempting to parse as HTML a response whose content type is
340
     * not HTML. The default is false (content type is ignored).
341
     *
342
     * @return true, if is check html content type
343
     */
344
    public static boolean isCheckHtmlContentType() {
345
        return _checkHtmlContentType;
1✔
346
    }
347

348
    /**
349
     * If true, HttpUnit throws an exception when attempting to parse as HTML a response whose content type is not HTML.
350
     * The default is false (content type is ignored).
351
     *
352
     * @param checkHtmlContentType
353
     *            the new check html content type
354
     */
355
    public static void setCheckHtmlContentType(boolean checkHtmlContentType) {
356
        _checkHtmlContentType = checkHtmlContentType;
1✔
357
    }
1✔
358

359
    /**
360
     * Returns true if HttpUnit should automatically follow page redirect requests (status 3xx). By default, this is
361
     * true.
362
     *
363
     * @return the auto redirect
364
     *
365
     * @deprecated as of 1.5.3, use ClientProperties#isAutoRedirect();
366
     */
367
    @Deprecated
368
    public static boolean getAutoRedirect() {
369
        return ClientProperties.getDefaultProperties().isAutoRedirect();
×
370
    }
371

372
    /**
373
     * Determines whether HttpUnit should automatically follow page redirect requests (status 3xx). By default, this is
374
     * true in order to simulate normal browser operation.
375
     *
376
     * @param autoRedirect
377
     *            the new auto redirect
378
     *
379
     * @deprecated as of 1.5.3, use ClientProperties#setAutoRedirect();
380
     */
381
    @Deprecated
382
    public static void setAutoRedirect(boolean autoRedirect) {
383
        ClientProperties.getDefaultProperties().setAutoRedirect(autoRedirect);
×
384
    }
×
385

386
    /**
387
     * Returns the delay, in milliseconds, before a redirect request is issues.
388
     *
389
     * @return the redirect delay
390
     */
391
    public static int getRedirectDelay() {
392
        return _redirectDelay;
1✔
393
    }
394

395
    /**
396
     * Sets the delay, in milliseconds, before a redirect request is issued. This may be necessary if the server under
397
     * some cases where the server performs asynchronous processing which must be completed before the new request can
398
     * be handled properly, and is taking advantage of slower processing by most user agents. It almost always indicates
399
     * an error in the server design, and therefore the default delay is zero.
400
     *
401
     * @param delayInMilliseconds
402
     *            the new redirect delay
403
     */
404
    public static void setRedirectDelay(int delayInMilliseconds) {
405
        _redirectDelay = delayInMilliseconds;
×
406
    }
×
407

408
    /**
409
     * Returns true if HttpUnit should automatically follow page refresh requests. By default, this is false, so that
410
     * programs can verify the redirect page presented to users before the browser switches to the new page.
411
     *
412
     * @return the auto refresh
413
     *
414
     * @deprecated as of 1.5.3, use ClientProperties#isAutoRefresh();
415
     */
416
    @Deprecated
417
    public static boolean getAutoRefresh() {
418
        return ClientProperties.getDefaultProperties().isAutoRefresh();
×
419
    }
420

421
    /**
422
     * Specifies whether HttpUnit should automatically follow page refresh requests. By default, this is false, so that
423
     * programs can verify the redirect page presented to users before the browser switches to the new page. Setting
424
     * this to true can cause an infinite loop on pages that refresh themselves.
425
     *
426
     * @param autoRefresh
427
     *            the new auto refresh
428
     *
429
     * @deprecated as of 1.5.3, use ClientProperties#setAutoRefresh();
430
     */
431
    @Deprecated
432
    public static void setAutoRefresh(boolean autoRefresh) {
433
        ClientProperties.getDefaultProperties().setAutoRefresh(autoRefresh);
×
434
    }
×
435

436
    /**
437
     * Remove an Html error listener.
438
     *
439
     * @param el
440
     *            the el
441
     *
442
     * @deprecated as of 1.5.2, use HTMLParserfactory#removeHTMLParserListener
443
     */
444
    @Deprecated
445
    public static void removeHtmlErrorListener(HTMLParserListener el) {
446
        HTMLParserFactory.removeHTMLParserListener(el);
×
447
    }
×
448

449
    /**
450
     * Add an Html error listener.
451
     *
452
     * @param el
453
     *            the el
454
     *
455
     * @deprecated as of 1.5.2, use HTMLParserfactory#addHTMLParserListener
456
     */
457
    @Deprecated
458
    public static void addHtmlErrorListener(HTMLParserListener el) {
459
        HTMLParserFactory.addHTMLParserListener(el);
×
460
    }
×
461

462
    /**
463
     * Get the list of Html Error Listeners.
464
     *
465
     * @return the html error listeners
466
     *
467
     * @deprecated as of 1.5.2, removed with no replacement
468
     */
469
    @Deprecated
470
    public static List getHtmlErrorListeners() {
471
        return null;
×
472
    }
473

474
    /**
475
     * Gets the script engine class name.
476
     *
477
     * @return the script engine class name
478
     */
479
    public static String getScriptEngineClassName() {
480
        return _scriptEngineClassName;
×
481
    }
482

483
    /**
484
     * Sets the script engine class name.
485
     *
486
     * @param scriptEngineClassName
487
     *            the new script engine class name
488
     */
489
    public static void setScriptEngineClassName(String scriptEngineClassName) {
490
        if (_scriptEngineClassName == null || !_scriptEngineClassName.equals(scriptEngineClassName)) {
1!
491
            _scriptingEngine = null;
1✔
492
        }
493
        _scriptEngineClassName = scriptEngineClassName;
1✔
494
    }
1✔
495

496
    /**
497
     * Gets the scripting engine.
498
     *
499
     * @return the scripting engine
500
     */
501
    public static ScriptingEngineFactory getScriptingEngine() {
502
        if (_scriptingEngine == null) {
1✔
503
            try {
504
                Class factoryClass = Class.forName(_scriptEngineClassName);
1✔
505
                final ScriptingEngineFactory factory = (ScriptingEngineFactory) factoryClass.getDeclaredConstructor()
1✔
506
                        .newInstance();
1✔
507
                _scriptingEngine = factory.isEnabled() ? factory : NULL_SCRIPTING_ENGINE_FACTORY;
1!
508
                _scriptingEngine.setThrowExceptionsOnError(_exceptionsThrownOnScriptError);
1✔
509
            } catch (ClassNotFoundException e) {
×
510
                disableScripting(e, "Unable to find scripting engine factory class ");
×
511
            } catch (InstantiationException e) {
×
512
                disableScripting(e, "Unable to instantiate scripting engine factory class ");
×
513
            } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
×
514
                    | NoSuchMethodException | SecurityException e) {
515
                disableScripting(e, "Unable to create scripting engine factory class ");
×
516
            }
1✔
517
        }
518
        return _scriptingEngine;
1✔
519
    }
520

521
    /**
522
     * change the scriptingEnabled flag.
523
     *
524
     * @param scriptingEnabled
525
     *            the new scripting enabled
526
     */
527
    public static void setScriptingEnabled(boolean scriptingEnabled) {
528
        if (scriptingEnabled != _scriptingEnabled) {
1✔
529
            _scriptingEngine = scriptingEnabled ? null : NULL_SCRIPTING_ENGINE_FACTORY;
1✔
530
        }
531
        _scriptingEnabled = scriptingEnabled;
1✔
532
    }
1✔
533

534
    /**
535
     * Checks if is scripting enabled.
536
     *
537
     * @return true, if is scripting enabled
538
     */
539
    public static boolean isScriptingEnabled() {
540
        return _scriptingEnabled;
1✔
541
    }
542

543
    /**
544
     * Determines whether script errors result in exceptions or warning messages.
545
     *
546
     * @param throwExceptions
547
     *            the throw exceptions
548
     *
549
     * @return the current state
550
     */
551
    public static boolean setExceptionsThrownOnScriptError(boolean throwExceptions) {
552
        boolean current = _exceptionsThrownOnScriptError;
1✔
553
        _exceptionsThrownOnScriptError = throwExceptions;
1✔
554
        getScriptingEngine().setThrowExceptionsOnError(throwExceptions);
1✔
555
        return current;
1✔
556
    }
557

558
    /**
559
     * Returns true if script errors cause exceptions to be thrown.
560
     *
561
     * @return the exceptions thrown on script error
562
     */
563
    public static boolean getExceptionsThrownOnScriptError() {
564
        return _exceptionsThrownOnScriptError;
1✔
565
    }
566

567
    /**
568
     * Returns the accumulated script error messages encountered. Error messages are accumulated only if
569
     * 'throwExceptionsOnError' is disabled.
570
     *
571
     * @return the script error messages
572
     */
573
    public static String[] getScriptErrorMessages() {
574
        return getScriptingEngine().getErrorMessages();
1✔
575
    }
576

577
    /**
578
     * Clears the accumulated script error messages.
579
     */
580
    public static void clearScriptErrorMessages() {
581
        getScriptingEngine().clearErrorMessages();
1✔
582
    }
1✔
583

584
    /**
585
     * Disable scripting.
586
     *
587
     * @param e
588
     *            the e
589
     * @param errorMessage
590
     *            the error message
591
     */
592
    private static void disableScripting(Exception e, String errorMessage) {
593
        System.err.println(errorMessage + _scriptEngineClassName);
×
594
        System.err.println("" + e);
×
595
        System.err.println("JavaScript execution disabled");
×
596
        _scriptingEngine = NULL_SCRIPTING_ENGINE_FACTORY;
×
597
    }
×
598

599
    // --------------------------------- private members --------------------------------------
600

601
    /** The Constant DEFAULT_CONTENT_TYPE. */
602
    private static final String DEFAULT_CONTENT_TYPE = "text/html";
603

604
    /** The Constant NULL_SCRIPTING_ENGINE_FACTORY. */
605
    private static final ScriptingEngineFactory NULL_SCRIPTING_ENGINE_FACTORY = new ScriptingEngineFactory() {
1✔
606
        @Override
607
        public boolean isEnabled() {
608
            return false;
×
609
        }
610

611
        @Override
612
        public void associate(WebResponse response) {
613
        }
1✔
614

615
        @Override
616
        public void load(WebResponse response) {
617
        }
1✔
618

619
        @Override
620
        public void setThrowExceptionsOnError(boolean throwExceptions) {
621
        }
×
622

623
        @Override
624
        public boolean isThrowExceptionsOnError() {
625
            return false;
×
626
        }
627

628
        @Override
629
        public String[] getErrorMessages() {
630
            return new String[0];
×
631
        }
632

633
        @Override
634
        public void clearErrorMessages() {
635
        }
×
636

637
        @Override
638
        public ScriptingHandler createHandler(HTMLElement element) {
639
            return ScriptableDelegate.NULL_SCRIPT_ENGINE;
1✔
640
        }
641

642
        @Override
643
        public ScriptingHandler createHandler(WebResponse response) {
644
            return ScriptableDelegate.NULL_SCRIPT_ENGINE;
×
645
        }
646

647
        @Override
648
        public void handleScriptException(Exception e, String badScript) {
649
            // happily ignore and exception
650
        }
×
651
    };
652

653
    /**
654
     * Add the name of a custom attribute that should be supported for form controls.
655
     *
656
     * @param attributeName
657
     *            the attribute name
658
     *
659
     * @deprecated for new Scripting engine
660
     */
661
    @Deprecated
662
    public static void addCustomAttribute(String attributeName) {
663
        if (_customAttributes == null) {
1!
664
            _customAttributes = new HashSet<>();
1✔
665
        }
666
        _customAttributes.add(attributeName);
1✔
667
    }
1✔
668

669
    /**
670
     * Get the Set of custom attribute names to be supported by form controls.
671
     *
672
     * @return the custom attributes
673
     *
674
     * @deprecated for new scripting engine
675
     */
676
    @Deprecated
677
    static Set getCustomAttributes() {
678
        return _customAttributes;
1✔
679
    }
680

681
    /** The custom attributes. */
682
    private static Set _customAttributes = null;
1✔
683

684
    /** The exceptions on error status. */
685
    private static boolean _exceptionsOnErrorStatus = true;
1✔
686

687
    /** The parameter values validated. */
688
    private static boolean _parameterValuesValidated = true;
1✔
689

690
    /** The images treated as alt text. */
691
    private static boolean _imagesTreatedAsAltText;
692

693
    /** The logging http headers. */
694
    private static boolean _loggingHttpHeaders;
695

696
    /** The matches ignore case. */
697
    private static boolean _matchesIgnoreCase = true;
1✔
698

699
    /** The post includes charset. */
700
    private static boolean _postIncludesCharset = false;
1✔
701

702
    /** The check content length. */
703
    private static boolean _checkContentLength = false;
1✔
704

705
    /** The redirect delay. */
706
    private static int _redirectDelay;
707

708
    /** The character set. */
709
    private static String _characterSet = StandardCharsets.ISO_8859_1.name();
1✔
710

711
    /** The content type. */
712
    private static String _contentType = DEFAULT_CONTENT_TYPE;
1✔
713

714
    /** The script engine class name. */
715
    private static String _scriptEngineClassName;
716

717
    /** The scripting engine. */
718
    private static ScriptingEngineFactory _scriptingEngine;
719

720
    /** The scripting enabled. */
721
    private static boolean _scriptingEnabled = true;
1✔
722

723
    /** The exceptions thrown on script error. */
724
    private static boolean _exceptionsThrownOnScriptError = true;
1✔
725

726
    /** The java script optimization level. */
727
    private static int _javaScriptOptimizationLevel = -1;
1✔
728

729
    /** The check html content type. */
730
    private static boolean _checkHtmlContentType = false;
1✔
731

732
    static {
733
        reset();
1✔
734

735
    }
1✔
736

737
    /**
738
     * getter for Java Script optimization level.
739
     *
740
     * @return the javaScriptOptimizationLevel to be use for running scripts
741
     */
742
    public static int getJavaScriptOptimizationLevel() {
743
        return _javaScriptOptimizationLevel;
1✔
744
    }
745

746
    /**
747
     * setter for Java Script optimization level.
748
     *
749
     * @param scriptOptimizationLevel
750
     *            the _javaScriptOptimizationLevel to set see rhino documentation for valid values: -2: with
751
     *            continuation -1: interpret 0: compile to Java bytecode, don't optimize 1..9: compile to Java bytecode,
752
     *            optimize *
753
     */
754
    public static void setJavaScriptOptimizationLevel(int scriptOptimizationLevel) {
755
        _javaScriptOptimizationLevel = scriptOptimizationLevel;
×
756
    }
×
757
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc