/** * Returns the URL of this page. * @return the URL of this page */ @Override public URL getUrl() { final WebResponse wr = getWebResponse(); if (null == wr) { return WebClient.URL_ABOUT_BLANK; } return getWebResponse().getWebRequest().getUrl(); }
/** * Returns the URL of this page. * @return the URL of this page */ @Override public URL getUrl() { return getWebResponse().getWebRequest().getUrl(); }
/** * Returns the value of the "referrer" property. * @return the value of the "referrer" property */ public String jsxGet_referrer() { final String referrer = getPage().getWebResponse().getRequestSettings().getAdditionalHeaders().get("Referer"); if (referrer == null) { return ""; } return referrer; }
/** * Returns the value of the "referrer" property. * @return the value of the "referrer" property */ public String jsxGet_referrer() { final String referrer = getPage().getWebResponse().getRequestSettings().getAdditionalHeaders().get("Referer"); if (referrer == null) { return ""; } return referrer; }
/** * Returns the value of the "referrer" property. * @return the value of the "referrer" property */ public String jsxGet_referrer() { final String referrer = getPage().getWebResponse().getRequestSettings().getAdditionalHeaders().get("Referer"); if (referrer == null) { return ""; } return referrer; }
/** * Returns the value of the {@code referrer} property. * @return the value of the {@code referrer} property */ @JsxGetter public String getReferrer() { String referrer = ""; final WebResponse webResponse = getPage().getWebResponse(); if (webResponse != null) { referrer = webResponse.getWebRequest().getAdditionalHeaders().get(HttpHeader.REFERER); if (referrer == null) { referrer = ""; } } return referrer; }
/** * Returns the value of the {@code referrer} property. * @return the value of the {@code referrer} property */ @JsxGetter public String getReferrer() { String referrer = ""; final WebResponse webResponse = getPage().getWebResponse(); if (webResponse != null) { referrer = webResponse.getWebRequest().getAdditionalHeaders().get(HttpHeader.REFERER); if (referrer == null) { referrer = ""; } } return referrer; }
/** * Returns the last modification date of the document. * @see <a href="https://developer.mozilla.org/en/DOM/document.lastModified">Mozilla documentation</a> * @return the date as string */ @JsxGetter public String getLastModified() { if (lastModified_ == null) { final WebResponse webResponse = getPage().getWebResponse(); final Date lastModified; if (webResponse != null) { String stringDate = webResponse.getResponseHeaderValue("Last-Modified"); if (stringDate == null) { stringDate = webResponse.getResponseHeaderValue("Date"); } lastModified = parseDateOrNow(stringDate); } else { lastModified = new Date(); } lastModified_ = new SimpleDateFormat(LAST_MODIFIED_DATE_FORMAT, Locale.ROOT).format(lastModified); } return lastModified_; }
/** * Returns the last modification date of the document. * @see <a href="https://developer.mozilla.org/en/DOM/document.lastModified">Mozilla documentation</a> * @return the date as string */ @JsxGetter public String getLastModified() { if (lastModified_ == null) { final WebResponse webResponse = getPage().getWebResponse(); final Date lastModified; if (webResponse != null) { String stringDate = webResponse.getResponseHeaderValue("Last-Modified"); if (stringDate == null) { stringDate = webResponse.getResponseHeaderValue("Date"); } lastModified = parseDateOrNow(stringDate); } else { lastModified = new Date(); } lastModified_ = new SimpleDateFormat(LAST_MODIFIED_DATE_FORMAT, Locale.ROOT).format(lastModified); } return lastModified_; }
/** * Returns <tt>true</tt> 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 <tt>true</tt> 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().getWebResponse().getRequestSettings().getUrl(); final String home = getDomNodeOrDie().getPage().getEnclosingWindow().getWebClient().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 <tt>true</tt> 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 <tt>true</tt> 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().getWebResponse().getRequestSettings().getUrl(); final String home = getDomNodeOrDie().getPage().getEnclosingWindow().getWebClient().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 <tt>true</tt> 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 <tt>true</tt> 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().getWebResponse().getRequestSettings().getUrl(); final String home = getDomNodeOrDie().getPage().getEnclosingWindow().getWebClient().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 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_; }
/** * 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 = (SimpleScriptable) node_.getScriptObject(); // compile "just in time" if (realFunction_ == null) { realFunction_ = cx.compileFunction(jsObj, jsSnippet_, eventName_ + " event for " + node_ + " in " + node_.getPage().getWebResponse().getRequestSettings().getUrl(), 0, null); } final Object result = realFunction_.call(cx, scope, thisObj, args); return result; }
/** * {@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 = (SimpleScriptable) node_.getScriptObject(); // compile "just in time" if (realFunction_ == null) { realFunction_ = cx.compileFunction(jsObj, jsSnippet_, eventName_ + " event for " + node_ + " in " + node_.getPage().getWebResponse().getRequestSettings().getUrl(), 0, null); } final Object result = realFunction_.call(cx, scope, thisObj, args); return result; }
/** * {@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 = (SimpleScriptable) node_.getScriptObject(); // compile "just in time" if (realFunction_ == null) { realFunction_ = cx.compileFunction(jsObj, jsSnippet_, eventName_ + " event for " + node_ + " in " + node_.getPage().getWebResponse().getRequestSettings().getUrl(), 0, null); } final Object result = realFunction_.call(cx, scope, thisObj, args); return result; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ @JsxGetter public CSSStyleSheet getSheet() { if (sheet_ != null) { return sheet_; } final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); final String css = style.getTextContent(); final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final org.w3c.dom.css.CSSStyleSheet cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getWebRequest() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new CSSStyleSheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new CSSStyleSheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ @JsxGetter public CSSStyleSheet getSheet() { if (sheet_ != null) { return sheet_; } final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); final String css = style.getTextContent(); final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final CSSStyleSheetImpl cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getWebRequest() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new CSSStyleSheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new CSSStyleSheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }
/** * Gets the associated sheet. * @see <a href="http://www.xulplanet.com/references/objref/HTMLStyleElement.html">Mozilla doc</a> * @return the sheet */ public Stylesheet jsxGet_sheet() { if (sheet_ != null) { return sheet_; } String css = ""; final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); if (style.getFirstChild() != null) { css = style.getFirstChild().asText(); } final Cache cache = getWindow().getWebWindow().getWebClient().getCache(); final CSSStyleSheet cached = cache.getCachedStyleSheet(css); final String uri = getDomNodeOrDie().getPage().getWebResponse().getRequestSettings() .getUrl().toExternalForm(); if (cached != null) { sheet_ = new Stylesheet(this, cached, uri); } else { final InputSource source = new InputSource(new StringReader(css)); sheet_ = new Stylesheet(this, source, uri); cache.cache(css, sheet_.getWrappedSheet()); } return sheet_; }