/** * {@inheritDoc} */ @Override public String getBaseURI() { return getPage().getUrl().toExternalForm(); }
/** * {@inheritDoc} */ @Override public String getBaseURI() { return getPage().getUrl().toExternalForm(); }
/** * Returns the value of the {@code URL} property. * @return the value of the {@code URL} property */ @JsxGetter(propertyName = "URL") public String getURL() { return getPage().getUrl().toExternalForm(); }
/** * Returns the value of the {@code URL} property. * @return the value of the {@code URL} property */ @JsxGetter(propertyName = "URL") public String getURL() { if (!(getPage() instanceof HtmlPage)) { // TODO: implement XmlPage.getUrl return ""; } return getPage().getUrl().toExternalForm(); }
msg.append("'"); try { msg.append(" url: '").append(page.getUrl()).append('\''); msg.append(" content: "); msg.append(page.getWebResponse().getContentAsString());
msg.append('\''); try { msg.append(" url: '").append(page.getUrl()).append('\''); msg.append(" content: "); msg.append(page.getWebResponse().getContentAsString());
/** * Creates an instance of HtmlMeta * * @param qualifiedName the qualified name of the element type to instantiate * @param page the HtmlPage that contains this element * @param attributes the initial attributes */ HtmlMeta(final String qualifiedName, final SgmlPage page, final Map<String, DomAttr> attributes) { super(qualifiedName, page, attributes); // Handles the cookies specified in meta tags, // like <tt><meta http-equiv='set-cookie' content='webm=none; path=/;'></tt>. if ("set-cookie".equalsIgnoreCase(getHttpEquivAttribute())) { final WebClient client = page.getWebClient(); final URL url = page.getUrl(); client.addCookie(getContentAttribute(), url, this); } }
/** * Handles the cookies specified in meta tags, * like <tt><meta http-equiv='set-cookie' content='webm=none; path=/;'></tt>. */ protected void performSetCookie() { final SgmlPage page = getPage(); final WebClient client = page.getWebClient(); final URL url = page.getUrl(); client.addCookie(getContentAttribute(), url, this); }
/** * Returns {@code true} if the specified URL is the web client's current * homepage and the document calling the method is on the same domain as the * user's homepage. Part of the <tt>#default#homePage</tt> default IE behavior * implementation. * @param url the URL to check * @return {@code true} if the specified URL is the current homepage */ public boolean isHomePage(final String url) { try { final URL newUrl = new URL(url); final URL currentUrl = getDomNodeOrDie().getPage().getUrl(); final String home = getDomNodeOrDie().getPage().getEnclosingWindow() .getWebClient().getOptions().getHomePage(); final boolean sameDomains = newUrl.getHost().equalsIgnoreCase(currentUrl.getHost()); final boolean isHomePage = home != null && home.equals(url); return sameDomains && isHomePage; } catch (final MalformedURLException e) { return false; } }
/** * Returns {@code true} if the specified URL is the web client's current * homepage and the document calling the method is on the same domain as the * user's homepage. Part of the <tt>#default#homePage</tt> default IE behavior * implementation. * @param url the URL to check * @return {@code true} if the specified URL is the current homepage */ public boolean isHomePage(final String url) { try { final URL newUrl = new URL(url); final URL currentUrl = getDomNodeOrDie().getPage().getUrl(); final String home = getDomNodeOrDie().getPage().getEnclosingWindow() .getWebClient().getOptions().getHomePage(); final boolean sameDomains = newUrl.getHost().equalsIgnoreCase(currentUrl.getHost()); final boolean isHomePage = home != null && home.equals(url); return sameDomains && isHomePage; } catch (final MalformedURLException e) { return false; } }
/** * {@inheritDoc} */ @Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) throws JavaScriptException { // the js object to which this event is attached has to be the scope final SimpleScriptable jsObj = node_.getScriptableObject(); // compile "just in time" if (realFunction_ == null) { realFunction_ = cx.compileFunction(jsObj, jsSnippet_, eventName_ + " event for " + node_ + " in " + node_.getPage().getUrl(), 0, null); realFunction_.setParentScope(jsObj); } return realFunction_.call(cx, scope, thisObj, args); }
/** * Returns the domain name of the server that served the document, or {@code null} if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ @JsxGetter({CHROME, IE}) public String getDomain() { if (domain_ == null && getPage().getWebResponse() != null) { URL url = getPage().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getUrl(); } else { return null; } } domain_ = url.getHost().toLowerCase(Locale.ROOT); } return domain_; }
/** * {@inheritDoc} */ @Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) throws JavaScriptException { // the js object to which this event is attached has to be the scope final SimpleScriptable jsObj = node_.getScriptableObject(); // compile "just in time" if (realFunction_ == null) { realFunction_ = cx.compileFunction(jsObj, jsSnippet_, eventName_ + " event for " + node_ + " in " + node_.getPage().getUrl(), 0, null); realFunction_.setParentScope(jsObj); } return realFunction_.call(cx, scope, thisObj, args); }
/** * Returns the domain name of the server that served the document, or {@code null} if the server * cannot be identified by a domain name. * @return the domain name of the server that served the document * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-2250147"> * W3C documentation</a> */ @JsxGetter({CHROME, IE}) public String getDomain() { if (domain_ == null && getPage().getWebResponse() != null) { URL url = getPage().getUrl(); if (url == WebClient.URL_ABOUT_BLANK) { final WebWindow w = getWindow().getWebWindow(); if (w instanceof FrameWindow) { url = ((FrameWindow) w).getEnclosingPage().getUrl(); } else { return null; } } domain_ = url.getHost().toLowerCase(Locale.ROOT); } return domain_; }
final String url = getPage().getUrl().toExternalForm(); final int line1 = getStartLineNumber(); final int line2 = getEndLineNumber();
final String url = getPage().getUrl().toExternalForm(); final int line1 = getStartLineNumber(); final int line2 = getEndLineNumber();
final String url = element.getPage().getUrl().toExternalForm(); final int line1 = element.getStartLineNumber(); final int line2 = element.getEndLineNumber();
final String url = element.getPage().getUrl().toExternalForm(); final int line1 = element.getStartLineNumber(); final int line2 = element.getEndLineNumber();
final WebRequest request = new WebRequest(url); request.setCharset(getPage().getCharset()); request.setAdditionalHeader(HttpHeader.REFERER, getPage().getUrl().toExternalForm()); getPage().getEnclosingWindow().getWebClient().getPage(enclosedWindow_, request);
/** * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property * {@link WebClient#setThrowExceptionOnFailingStatusCode(boolean)} is set to true */ private void loadInnerPageIfPossible(final String src) throws FailingHttpStatusCodeException { setContentLoaded(); if (!src.isEmpty()) { final URL url; try { url = ((HtmlPage) getPage()).getFullyQualifiedUrl(src); } catch (final MalformedURLException e) { notifyIncorrectness("Invalid src attribute of " + getTagName() + ": url=[" + src + "]. Ignored."); return; } if (isAlreadyLoadedByAncestor(url)) { notifyIncorrectness("Recursive src attribute of " + getTagName() + ": url=[" + src + "]. Ignored."); return; } try { final WebRequest request = new WebRequest(url); request.setCharset(getPage().getCharset()); request.setAdditionalHeader(HttpHeader.REFERER, getPage().getUrl().toExternalForm()); getPage().getEnclosingWindow().getWebClient().getPage(enclosedWindow_, request); } catch (final IOException e) { LOG.error("IOException when getting content for " + getTagName() + ": url=[" + url + "]", e); } } }