Sets the search property. @param search the search property
(final String search)
| 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. |
no test coverage detected