con = ProxyConfiguration.open(archive); if (lastModified != 0) { con.setIfModifiedSince(lastModified);
connection.setIfModifiedSince(timestamp);
conn.setIfModifiedSince(lastModified);
connection.setIfModifiedSince(timestamp);
connection.setIfModifiedSince(timestamp);
connection.setIfModifiedSince(timestamp);
@Override public void setIfModifiedSince(long ifmodifiedsince) { _conn.setIfModifiedSince(ifmodifiedsince); }
public void setIfModifiedSince(long ifModifiedSince) { connection.setIfModifiedSince(ifModifiedSince); this.ifModifiedSince = ifModifiedSince; }
public void setIfModifiedSince(long ifmodifiedsince) { delegateConnection.setIfModifiedSince(ifmodifiedsince); }
public void setIfModifiedSince(long ifmodifiedsince) { connection.setIfModifiedSince(ifmodifiedsince); }
void applyConditionals(URLConnection urlConnection) { if(lastModified != 0L) { urlConnection.setIfModifiedSince(lastModified); } if(entityTags != null && entityTags.length() > 0) { urlConnection.addRequestProperty("If-None-Match", entityTags); } }
void applyConditionals(URLConnection urlConnection) { if(lastModified != 0L) { urlConnection.setIfModifiedSince(lastModified); } if(entityTags != null && entityTags.length() > 0) { urlConnection.addRequestProperty("If-None-Match", entityTags); } }
void applyConditionals(URLConnection urlConnection) { if(lastModified != 0L) { urlConnection.setIfModifiedSince(lastModified); } if(entityTags != null && entityTags.length() > 0) { urlConnection.addRequestProperty("If-None-Match", entityTags); } }
void applyConditionals(URLConnection urlConnection) { if(lastModified != 0L) { urlConnection.setIfModifiedSince(lastModified); } if(entityTags != null && entityTags.length() > 0) { urlConnection.addRequestProperty("If-None-Match", entityTags); } }
void applyConditionals(URLConnection urlConnection) { if(lastModified != 0L) { urlConnection.setIfModifiedSince(lastModified); } if(entityTags != null && entityTags.length() > 0) { urlConnection.addRequestProperty("If-None-Match", entityTags); } }
private URLConnection getUrlIfNeeded(URL url, long now) throws IOException, RepositoryException { if (expires.containsKey(url) && now < expires.get(url)) return null; URLConnection open = url.openConnection(); open.setUseCaches(true); if (lastModified == 0) return open; open.setIfModifiedSince(lastModified); if (open.getLastModified() > lastModified) return open; return null; }
File f = new File();// the file to download HttpURLConnection con = (HttpURLConnection) new URL("http://www.test.com/"+f.getName()).openConnection(); // Add the IfModifiedSince HEADER con.setIfModifiedSince(f.lastModified()); con.setRequestMethod("GET"); con.connect(); if(con.getResponseCode() == 304) { System.out.println(f+ " : already downloaded"); } else { // Download the content again and store the image again }
public long lastModified() { try { URLConnection connection = getURL().openConnection(); connection.setAllowUserInteraction(false); connection.setUseCaches(true); connection.setIfModifiedSince(mLastModified); mLastModified = connection.getLastModified(); } catch (IOException ignore) { } return mLastModified; } }
/** * Loads the content of an URL containing text. * * @param url the URL of the text resource * @return the loaded String * @throws IOException if there is an IO problem */ public static String loadString( URL url ) throws IOException { URLConnection connection = url.openConnection(); connection.setDefaultUseCaches( false ); connection.setUseCaches( false ); connection.setIfModifiedSince( 0 ); return loadString( connection.getInputStream() ); }
/** * Loads the content of an URL containing binary data. * * @param url the URL of the binary data * @return the loaded bytes * @throws IOException if there is an IO problem */ public static byte[] loadBytes( URL url ) throws IOException { URLConnection connection = url.openConnection(); connection.setDefaultUseCaches( false ); connection.setUseCaches( false ); connection.setIfModifiedSince( 0 ); return loadBytes( connection.getInputStream() ); }