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

io.muserver.rest.DateHeaderDelegate Maven / Gradle / Ivy

The newest version!
package io.muserver.rest;

import io.muserver.Mutils;
import jakarta.ws.rs.ext.RuntimeDelegate;

import java.time.format.DateTimeParseException;
import java.util.Date;

class DateHeaderDelegate implements RuntimeDelegate.HeaderDelegate {

    @Override
    public Date fromString(String value) {
        try {
            return Mutils.fromHttpDate(value);
        } catch (DateTimeParseException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }

    @Override
    public String toString(Date value) {
        return Mutils.toHttpDate(value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy