Package utils

Source Code of utils.Headers

package utils;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import play.libs.F;
import play.mvc.Action;
import play.mvc.Http;
import play.mvc.Result;

public class Headers extends Action.Simple {

    private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZoneUTC();

    @Override
    public F.Promise<Result> call(Http.Context context) throws Throwable {
        context.response().setHeader("Server", "play2-java-jpa");
        context.response().setHeader("Date", RFC_1123_DATE_TIME.print(new DateTime()));
        return delegate.call(context);
    }
}
TOP

Related Classes of utils.Headers

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.