/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
@Override public int getHeaderFieldInt(String name, int Default) { return _conn.getHeaderFieldInt(name,Default); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
/** * Returns the content length in bytes specified by the response header field * {@code content-length} or {@code -1} if this field is not set. * * @return the value of the response header field {@code content-length}. */ public int getContentLength() { return getHeaderFieldInt("Content-Length", -1); }
public int getHeaderFieldInt(String name, int _default) { return delegateConnection.getHeaderFieldInt(name, _default); }
public int getHeaderFieldInt(String name, int Default) { return connection.getHeaderFieldInt(name, Default); }
private long getContentLength(HttpURLConnection conn) { String transferEncoding = conn.getHeaderField("Transfer-Encoding"); if (transferEncoding == null || transferEncoding.equalsIgnoreCase("chunked")) { return conn.getHeaderFieldInt("Content-Length", -1); } else { return -1; }
public int getHeaderFieldInt(String name, int def) throws IOException { if (cn == null) { throw new IOException(); } if (!connected) { cn.connect(); connected = true; } return cn.getHeaderFieldInt(name, def); }
public int getHeaderFieldInt(String header, int def) { try { handshake(); } catch (IOException ex) { } return connection.getHeaderFieldInt(header, def); }
/** * Checks for database lag and sleeps if {@code lag < getMaxLag()}. * @param connection the URL connection used in the request * @return true if there was sufficient database lag. * @see #getMaxLag() * @see <a href="https://mediawiki.org/wiki/Manual:Maxlag_parameter"> * MediaWiki documentation</a> * @since 0.32 */ protected synchronized boolean checkLag(URLConnection connection) { int lag = connection.getHeaderFieldInt("X-Database-Lag", -5); // X-Database-Lag is the current lag rounded down to the nearest integer. // Thus, we need to retry in case of equality. if (lag >= maxlag) { try { int time = connection.getHeaderFieldInt("Retry-After", 10); logger.log(Level.WARNING, "Current database lag {0} s exceeds maxlag of {1} s, waiting {2} s.", new Object[] { lag, maxlag, time }); Thread.sleep(time * 1000L); } catch (InterruptedException ignored) { } return true; } return false; }
urlConnection.getDate()); final long corrected_received_age = Math.max(apparent_age, urlConnection.getHeaderFieldInt("Age", 0) * 1000L); final long response_delay = response_time - request_time; final long corrected_initial_age = corrected_received_age +
urlConnection.getDate()); final long corrected_received_age = Math.max(apparent_age, urlConnection.getHeaderFieldInt("Age", 0) * 1000L); final long response_delay = response_time - request_time; final long corrected_initial_age = corrected_received_age +
urlConnection.getDate()); final long corrected_received_age = Math.max(apparent_age, urlConnection.getHeaderFieldInt("Age", 0) * 1000L); final long response_delay = response_time - request_time; final long corrected_initial_age = corrected_received_age +
urlConnection.getDate()); final long corrected_received_age = Math.max(apparent_age, urlConnection.getHeaderFieldInt("Age", 0) * 1000L); final long response_delay = response_time - request_time; final long corrected_initial_age = corrected_received_age +
@Test(expected = NetworkReactiveAuditException.class) public void getHeaderFieldInt() throws IOException { Assume.assumeTrue(IOTestTools.isNetworkConnected()); ReactiveAudit.off.commit(); URLConnection conn = new URL("http://" + HOST + ":" + PORT).openConnection(); TestTools.strict.commit(); conn.getHeaderFieldInt("expiration", 0); }