java.net.HttpURLConnection.setIfModifiedSince()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中java.net.HttpURLConnection.setIfModifiedSince()方法的一些代码示例,展示了HttpURLConnection.setIfModifiedSince()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpURLConnection.setIfModifiedSince()方法的具体详情如下:
包路径:java.net.HttpURLConnection
类名称:HttpURLConnection
方法名:setIfModifiedSince

HttpURLConnection.setIfModifiedSince介绍

暂无

代码示例

代码示例来源:origin: square/okhttp

@Override public void setIfModifiedSince(long newValue) {
 delegate.setIfModifiedSince(newValue);
}

代码示例来源:origin: prestodb/presto

@Override public void setIfModifiedSince(long newValue) {
 delegate.setIfModifiedSince(newValue);
}

代码示例来源:origin: square/okhttp

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: prestodb/presto

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: julian-klode/dns66

/**
 * Opens a new HTTP connection.
 *
 * @param file                           Target file
 * @param singleWriterMultipleReaderFile Target file
 * @param url                            URL to download from
 * @return An initialized HTTP connection.
 * @throws IOException
 */
@NonNull
HttpURLConnection getHttpURLConnection(File file, SingleWriterMultipleReaderFile singleWriterMultipleReaderFile, URL url) throws IOException {
  HttpURLConnection connection = internalOpenHttpConnection(url);
  connection.setConnectTimeout(CONNECT_TIMEOUT_MILLIS);
  connection.setReadTimeout(READ_TIMEOUT_MILLIS);
  try {
    singleWriterMultipleReaderFile.openRead().close();
    connection.setIfModifiedSince(file.lastModified());
  } catch (IOException e) {
    // Ignore addError here
  }
  connection.connect();
  return connection;
}

代码示例来源:origin: org.codelibs/jcifs

@Override
public void setIfModifiedSince ( long ifModifiedSince ) {
  this.connection.setIfModifiedSince(ifModifiedSince);
  this.ifModifiedSince = ifModifiedSince;
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Set the 'If-Modified-Since' request header to the given value
 *
 * @param value
 * @return this request
 */
public HttpRequest ifModifiedSince(final long value) {
 connection.setIfModifiedSince(value);
 return this;
}

代码示例来源:origin: gpfduoduo/AirPlay-Receiver-on-Android

/**
 * Set the 'If-Modified-Since' request header to the given value
 *
 * @param ifModifiedSince
 * @return this request
 */
public HttpRequest ifModifiedSince(final long ifModifiedSince) {
 getConnection().setIfModifiedSince(ifModifiedSince);
 return this;
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Set the 'If-Modified-Since' request header to the given value
 *
 * @param ifModifiedSince
 * @return this request
 */
public HttpRequest ifModifiedSince(final long ifModifiedSince) {
 getConnection().setIfModifiedSince(ifModifiedSince);
 return this;
}

代码示例来源:origin: biezhi/oh-my-request

/**
 * Set the 'If-Modified-Since' request header to the given value
 *
 * @param ifModifiedSince
 * @return this request
 */
public Request ifModifiedSince(final long ifModifiedSince) {
  getConnection().setIfModifiedSince(ifModifiedSince);
  return this;
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Set the 'If-Modified-Since' request header to the given value
 *
 * @param ifModifiedSince
 * @return this request
 */
public HttpRequest ifModifiedSince(final long ifModifiedSince) {
  getConnection().setIfModifiedSince(ifModifiedSince);
  return this;
}

代码示例来源:origin: com.bladejava/blade-kit

/**
 * Set the 'If-Modified-Since' request header to the given value
 *
 * @param ifModifiedSince
 * @return this request
 */
public HttpRequest ifModifiedSince(final long ifModifiedSince) {
  getConnection().setIfModifiedSince(ifModifiedSince);
  return this;
}

代码示例来源:origin: com.eas.platypus/platypus-js-core

@Override
public void visit(AppQueryRequest rq) throws Exception {
  method = PlatypusHttpConstants.HTTP_METHOD_GET;
  params.add(new AbstractMap.SimpleEntry<>(PlatypusHttpRequestParams.TYPE, "" + rq.getType()));
  params.add(new AbstractMap.SimpleEntry<>(PlatypusHttpRequestParams.QUERY_ID, rq.getQueryName()));
  pushRequest(rq, rq.getTimeStamp() != null ? (HttpURLConnection aConn) -> {
    aConn.setIfModifiedSince(rq.getTimeStamp().getTime());
  } : null);
}

代码示例来源:origin: com.eas.platypus/platypus-js-core

@Override
public void visit(ServerModuleStructureRequest rq) throws Exception {
  method = PlatypusHttpConstants.HTTP_METHOD_GET;
  params.add(new AbstractMap.SimpleEntry<>(PlatypusHttpRequestParams.TYPE, "" + rq.getType()));
  params.add(new AbstractMap.SimpleEntry<>(PlatypusHttpRequestParams.MODULE_NAME, rq.getModuleName()));
  pushRequest(rq, rq.getTimeStamp() != null ? (HttpURLConnection aConn) -> {
    aConn.setIfModifiedSince(rq.getTimeStamp().getTime());
  } : null);
}

代码示例来源:origin: apiman/apiman

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: com.github.ljun20160606/okhttp-urlconnection

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: com.squareup.okhttp/okhttp-urlconnection

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: com.squareup.okhttp3/okhttp-urlconnection

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: io.prestosql/presto-jdbc

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

代码示例来源:origin: com.facebook.presto/presto-jdbc

@Override public void setIfModifiedSince(long newValue) {
 super.setIfModifiedSince(newValue);
 if (ifModifiedSince != 0) {
  requestHeaders.set("If-Modified-Since", HttpDate.format(new Date(ifModifiedSince)));
 } else {
  requestHeaders.removeAll("If-Modified-Since");
 }
}

相关文章

HttpURLConnection类方法