All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.tio.http.common.utils.HttpDateTimer Maven / Gradle / Ivy

There is a newer version: 3.7.3.v20241201-RELEASE
Show newest version
package com.litongjava.tio.http.common.utils;

import com.litongjava.tio.http.common.HeaderValue;
import com.litongjava.tio.utils.SystemTimer;
import com.litongjava.tio.utils.SystemTimer.TimerListener;
import com.litongjava.tio.utils.hutool.DateUtil;

/**
 * 
 * @author tanyaowu 
 * 2018年6月17日 下午10:37:16
 */
public class HttpDateTimer {

  static {
    SystemTimer.addTimerListener(new TimerListener() {
      @Override
      public void onChange(long currTime) {
        httpDateString = DateUtil.httpDate(currTime);
        httpDateValue = HeaderValue.from(httpDateString);
      }
    });
  }

  private static volatile String httpDateString = DateUtil.httpDate();

  public static volatile HeaderValue httpDateValue = HeaderValue.from(httpDateString);

  public static String currDateString() {
    return httpDateString;
  }

  public static HeaderValue httpDateValue() {
    return httpDateValue;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy