@@ -514,7 +514,8 @@ <P extends Page> P getPage(final WebWindow webWindow, final WebRequest webReques
514514 /**
515515 * Convenient method to build a URL and load it into the current WebWindow as it would be done
516516 * by {@link #getPage(WebWindow, WebRequest)}.
517- * @param url the URL of the new content
517+ * @param url the URL of the new content; in contrast to real browsers plain file url's are not supported.
518+ * You have to use the 'file', 'data', 'blob', 'http' or 'https' protocol.
518519 * @param <P> the page type
519520 * @return the new page
520521 * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
@@ -530,7 +531,8 @@ public <P extends Page> P getPage(final String url) throws IOException, FailingH
530531 /**
531532 * Convenient method to load a URL into the current top WebWindow as it would be done
532533 * by {@link #getPage(WebWindow, WebRequest)}.
533- * @param url the URL of the new content
534+ * @param url the URL of the new content; in contrast to real browsers plain file url's are not supported.
535+ * You have to use the 'file', 'data', 'blob', 'http' or 'https' protocol.
534536 * @param <P> the page type
535537 * @return the new page
536538 * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
@@ -541,7 +543,6 @@ public <P extends Page> P getPage(final URL url) throws IOException, FailingHttp
541543 final WebRequest request = new WebRequest (url , getBrowserVersion ().getHtmlAcceptHeader (),
542544 getBrowserVersion ().getAcceptEncodingHeader ());
543545 request .setCharset (UTF_8 );
544-
545546 return getPage (getCurrentWindow ().getTopWindow (), request );
546547 }
547548
@@ -1546,7 +1547,8 @@ private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, f
15461547 * @return the WebResponse
15471548 */
15481549 public WebResponse loadWebResponse (final WebRequest webRequest ) throws IOException {
1549- switch (webRequest .getUrl ().getProtocol ()) {
1550+ final String protocol = webRequest .getUrl ().getProtocol ();
1551+ switch (protocol ) {
15501552 case UrlUtils .ABOUT :
15511553 return makeWebResponseForAboutUrl (webRequest );
15521554
@@ -1559,8 +1561,12 @@ public WebResponse loadWebResponse(final WebRequest webRequest) throws IOExcepti
15591561 case "blob" :
15601562 return makeWebResponseForBlobUrl (webRequest );
15611563
1562- default :
1564+ case "http" :
1565+ case "https" :
15631566 return loadWebResponseFromWebConnection (webRequest , ALLOWED_REDIRECTIONS_SAME_URL );
1567+
1568+ default :
1569+ throw new IOException ("Unsupported protocol '" + protocol + "'" );
15641570 }
15651571 }
15661572
0 commit comments