MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / setSearch

Method setSearch

src/main/java/org/htmlunit/javascript/host/URL.java:428–451  ·  view source on GitHub ↗

Sets the search property. @param search the search property

(final String search)

Source from the content-addressed store, hash-verified

426 * @param search the {@code search} property
427 */
428 @JsxSetter
429 public void setSearch(final String search) throws MalformedURLException {
430 if (url_ == null) {
431 return;
432 }
433
434 String query;
435 if (search == null
436 || org.htmlunit.util.StringUtils.equalsChar('?', search)
437 || org.htmlunit.util.StringUtils.isEmptyString(search)) {
438 query = null;
439 }
440 else {
441 if (search.charAt(0) == '?') {
442 query = search.substring(1);
443 }
444 else {
445 query = search;
446 }
447 query = UrlUtils.encodeQuery(query);
448 }
449
450 url_ = UrlUtils.getUrlWithNewQuery(url_, query);
451 }
452
453 /**
454 * Sets the {@code search} property based on {@link NameValuePair}'s.

Callers 4

jsConstructorMethod · 0.45
appendMethod · 0.45
deleteMethod · 0.45
setMethod · 0.45

Calls 11

encodeQueryMethod · 0.95
getUrlWithNewQueryMethod · 0.95
encodeQueryPartMethod · 0.95
substringMethod · 0.80
lengthMethod · 0.65
getNameMethod · 0.65
equalsCharMethod · 0.45
isEmptyStringMethod · 0.45
appendMethod · 0.45
getValueMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected