APISonar


io.undertow.util.Headers.DATE

> io > undertow > util > Headers > DATE
io APIs undertow APIs util APIs Headers APIs DATE APIs

Example 1
public void handleRequest(final HttpServerExchange exchange) throws Exception {
        // better method is used in DateUtils#addDateHeaderIfRequired
        long time = System.nanoTime();
        if(time < nextUpdateTime) {
            exchange.getResponseHeaders().put(Headers.DATE, cachedDateString);
        } else {
            long realTime = System.currentTimeMillis();
            String dateString = DateUtils.toDateString(new Date(realTime));
            cachedDateString = dateString;
            nextUpdateTime = time + 1000000000;
            exchange.getResponseHeaders().put(Headers.DATE, dateString);
        }
        next.handleRequest(exchange);
    }