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

com.vtence.molecule.middlewares.DateHeader Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package com.vtence.molecule.middlewares;

import com.vtence.molecule.Request;
import com.vtence.molecule.Response;
import com.vtence.molecule.lib.Clock;
import com.vtence.molecule.lib.SystemClock;

import static com.vtence.molecule.http.HeaderNames.DATE;

public class DateHeader extends AbstractMiddleware {

    private final Clock clock;

    public DateHeader() {
        this(new SystemClock());
    }

    public DateHeader(Clock clock) {
        this.clock = clock;
    }

    public void handle(Request request, Response response) throws Exception {
        response.header(DATE, clock.now());

        forward(request, response);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy