Example usage for org.apache.wicket.request.http WebResponse addHeader

List of usage examples for org.apache.wicket.request.http WebResponse addHeader

Introduction

In this page you can find the example usage for org.apache.wicket.request.http WebResponse addHeader.

Prototype

public abstract void addHeader(String name, String value);

Source Link

Document

Add a value to the servlet response stream.

Usage

From source file:com.gitblit.wicket.pages.BasePage.java

License:Apache License

/**
 * Sets the last-modified header field and the expires field.
 *
 * @param when/*  w  w w. ja  v  a  2  s.  com*/
 */
protected final void setLastModified(Date when) {
    if (when == null) {
        return;
    }

    if (when.before(app().getBootDate())) {
        // last-modified can not be before the Gitblit boot date
        // this helps ensure that pages are properly refreshed after a
        // server config change
        when = app().getBootDate();
    }

    int expires = app().settings().getInteger(Keys.web.pageCacheExpires, 0);
    WebResponse response = (WebResponse) getResponse();
    response.setLastModifiedTime(Time.valueOf(when));
    response.addHeader("Expires",
            String.valueOf(System.currentTimeMillis() + Duration.minutes(expires).getMilliseconds()));
}

From source file:net.micwin.openspace.view.BasePageView.java

License:Open Source License

@Override
protected void setHeaders(WebResponse response) {
    super.setHeaders(response);
    response.addHeader("refresh", "30");
}