/** * Convenient method to load a URL into the current top WebWindow as it would be done * by {@link #getPage(WebWindow, WebRequest)}. * @param url the URL of the new content * @param <P> the page type * @return the new page * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property * {@link WebClientOptions#setThrowExceptionOnFailingStatusCode(boolean)} is set to true. * @throws IOException if an IO problem occurs */ @SuppressWarnings("unchecked") public <P extends Page> P getPage(final URL url) throws IOException, FailingHttpStatusCodeException { final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(StandardCharsets.UTF_8); return (P) getPage(getCurrentWindow().getTopWindow(), request); }
/** * Convenient method to load a URL into the current top WebWindow as it would be done * by {@link #getPage(WebWindow, WebRequest)}. * @param url the URL of the new content * @param <P> the page type * @return the new page * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property * {@link WebClientOptions#setThrowExceptionOnFailingStatusCode(boolean)} is set to true. * @throws IOException if an IO problem occurs */ @SuppressWarnings("unchecked") public <P extends Page> P getPage(final URL url) throws IOException, FailingHttpStatusCodeException { final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(UTF_8); return (P) getPage(getCurrentWindow().getTopWindow(), request); }
final WebRequest webRequest = new WebRequest(url, browser.getHtmlAcceptHeader());
if (url != null) { try { final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(StandardCharsets.UTF_8);
if (url != null) { try { final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(UTF_8);
final WebRequest webRequest = new WebRequest(url, browser.getHtmlAcceptHeader());
final WebRequest request = new WebRequest(url, browser.getHtmlAcceptHeader()); request.setHttpMethod(method); request.setRequestParameters(parameters);
request.setAdditionalHeader(HttpHeader.ACCEPT, browser.getHtmlAcceptHeader()); request.setAdditionalHeader(HttpHeader.ACCEPT_ENCODING, "gzip, deflate"); request.setRequestParameters(parameters);
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(StandardCharsets.UTF_8); if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) { final String referer = openerPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); } getPage(window, request); return window; }
/** * <p><span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span></p> * * Opens a new dialog window. * @param url the URL of the document to load and display * @param opener the web window that is opening the dialog * @param dialogArguments the object to make available inside the dialog via <tt>window.dialogArguments</tt> * @return the new dialog window * @throws IOException if there is an IO error */ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, final Object dialogArguments) throws IOException { WebAssert.notNull("url", url); WebAssert.notNull("opener", opener); final DialogWindow window = new DialogWindow(this, dialogArguments); fireWindowOpened(new WebWindowEvent(window, WebWindowEvent.OPEN, null, null)); final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); request.setCharset(UTF_8); if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) { final String referer = openerPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); } getPage(window, request); return window; }
workPiece_.htmlAcceptHeader_ = version.getHtmlAcceptHeader(); workPiece_.imgAcceptHeader_ = version.getImgAcceptHeader(); workPiece_.cssAcceptHeader_ = version.getCssAcceptHeader();
workPiece_.htmlAcceptHeader_ = version.getHtmlAcceptHeader(); workPiece_.imgAcceptHeader_ = version.getImgAcceptHeader(); workPiece_.cssAcceptHeader_ = version.getCssAcceptHeader();