/** * {@link CookieSpec#match(String, int, String, boolean, Cookie[])} doesn't like empty hosts and * negative ports, but these things happen if we're dealing with a local file. This method * allows us to work around this limitation in HttpClient by feeding it a bogus host and port. * * @param url the URL to replace if necessary * @return the replacement URL, or the original URL if no replacement was necessary */ private static URL replaceForCookieIfNecessary(URL url) { final String protocol = url.getProtocol(); final boolean file = "file".equals(protocol); if (file) { try { url = getUrlWithNewPort(getUrlWithNewHost(url, "LOCAL_FILESYSTEM"), 0); } catch (final MalformedURLException e) { throw new RuntimeException(e); } } return url; }
/** * {@link CookieSpec#match(String, int, String, boolean, Cookie[])} doesn't like empty hosts and * negative ports, but these things happen if we're dealing with a local file. This method * allows us to work around this limitation in HttpClient by feeding it a bogus host and port. * * @param url the URL to replace if necessary * @return the replacement URL, or the original URL if no replacement was necessary */ private static URL replaceForCookieIfNecessary(URL url) { final String protocol = url.getProtocol(); final boolean file = "file".equals(protocol); if (file) { try { url = getUrlWithNewPort(getUrlWithNewHost(url, "LOCAL_FILESYSTEM"), 0); } catch (final MalformedURLException e) { throw new RuntimeException(e); } } return url; }
/** * {@link CookieSpec#match(String, int, String, boolean, Cookie[])} doesn't like empty hosts and * negative ports, but these things happen if we're dealing with a local file. This method * allows us to work around this limitation in HttpClient by feeding it a bogus host and port. * * @param url the URL to replace if necessary * @return the replacement URL, or the original URL if no replacement was necessary */ private static URL replaceForCookieIfNecessary(URL url) { final String protocol = url.getProtocol(); final boolean file = "file".equals(protocol); if (file) { try { url = getUrlWithNewPort(getUrlWithNewHost(url, "LOCAL_FILESYSTEM"), 0); } catch (final MalformedURLException e) { throw new RuntimeException(e); } } return url; }
/** * Sets the hostname portion of the location URL. * @param hostname the new hostname portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ public void jsxSet_hostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the location URL. * @param hostname the new hostname portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ public void jsxSet_hostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the link's URL. * @param hostname the new hostname portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ public void jsxSet_hostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the link's URL. * @param hostname the new hostname portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ public void jsxSet_hostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the link's URL. * @param hostname the new hostname portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ public void jsxSet_hostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the location URL. * @param hostname the new hostname portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ public void jsxSet_hostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the host portion of the link's URL (the '[hostname]:[port]' portion). * @param host the new host portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a> */ public void jsxSet_host(final String host) throws Exception { final String hostname; final int port; final int index = host.indexOf(':'); if (index != -1) { hostname = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { hostname = host; port = -1; } final URL url1 = UrlUtils.getUrlWithNewHost(getUrl(), hostname); final URL url2 = UrlUtils.getUrlWithNewPort(url1, port); setUrl(url2); }
/** * Sets the host portion of the link's URL (the '[hostname]:[port]' portion). * @param host the new host portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a> */ public void jsxSet_host(final String host) throws Exception { final String hostname; final int port; final int index = host.indexOf(':'); if (index != -1) { hostname = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { hostname = host; port = -1; } final URL url1 = UrlUtils.getUrlWithNewHost(getUrl(), hostname); final URL url2 = UrlUtils.getUrlWithNewPort(url1, port); setUrl(url2); }
/** * Sets the host portion of the location URL (the '[hostname]:[port]' portion). * @param host the new host portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a> */ public void jsxSet_host(final String host) throws Exception { final String hostname; final int port; final int index = host.indexOf(':'); if (index != -1) { hostname = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { hostname = host; port = -1; } final URL url1 = UrlUtils.getUrlWithNewHost(getUrl(), hostname); final URL url2 = UrlUtils.getUrlWithNewPort(url1, port); setUrl(url2); }
if (!idn.equals(url.getHost())) { try { url = UrlUtils.getUrlWithNewHost(url, idn);
/** * Sets the host portion of the location URL (the '[hostname]:[port]' portion). * @param host the new host portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a> */ public void jsxSet_host(final String host) throws Exception { final String hostname; final int port; final int index = host.indexOf(':'); if (index != -1) { hostname = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { hostname = host; port = -1; } final URL url1 = UrlUtils.getUrlWithNewHost(getUrl(), hostname); final URL url2 = UrlUtils.getUrlWithNewPort(url1, port); setUrl(url2); }
/** * Sets the host portion of the link's URL (the '[hostname]:[port]' portion). * @param host the new host portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a> */ public void jsxSet_host(final String host) throws Exception { final String hostname; final int port; final int index = host.indexOf(':'); if (index != -1) { hostname = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { hostname = host; port = -1; } final URL url1 = UrlUtils.getUrlWithNewHost(getUrl(), hostname); final URL url2 = UrlUtils.getUrlWithNewPort(url1, port); setUrl(url2); }
/** * Sets the host portion of the location URL (the '[hostname]:[port]' portion). * @param host the new host portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a> */ public void jsxSet_host(final String host) throws Exception { final String hostname; final int port; final int index = host.indexOf(':'); if (index != -1) { hostname = host.substring(0, index); port = Integer.parseInt(host.substring(index + 1)); } else { hostname = host; port = -1; } final URL url1 = UrlUtils.getUrlWithNewHost(getUrl(), hostname); final URL url2 = UrlUtils.getUrlWithNewPort(url1, port); setUrl(url2); }
/** * Sets the hostname portion of the location URL. * @param hostname the new hostname portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ @JsxSetter public void setHostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the location URL. * @param hostname the new hostname portion of the location URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ @JsxSetter public void setHostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the link's URL. * @param hostname the new hostname portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ @JsxSetter public void setHostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }
/** * Sets the hostname portion of the link's URL. * @param hostname the new hostname portion of the link's URL * @throws Exception if an error occurs * @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a> */ @JsxSetter public void setHostname(final String hostname) throws Exception { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); }