package org.xbib.io.webdav.common;

/**
 * Implements a timeout header for subscription polling.
 */
public class PollTimeoutHeader extends TimeoutHeader {

    public PollTimeoutHeader(long timeout) {
        super(timeout);
    }

    @Override
    public String getHeaderName() {
        return "PollTimeout";
    }

    /**
     * Parses the request timeout header and converts it into a new
     * <code>PollTimeoutHeader</code> object.<br>The default value is used as
     * fallback if the String is not parseable.
     *
     * @param defaultValue
     * @return a new PollTimeoutHeader object.
     */
    public static PollTimeoutHeader parseHeader(/*HttpServletRequest request,*/ String timeoutStr, long defaultValue) {
        //String timeoutStr = request.getHeader(ObservationConstants.HEADER_POLL_TIMEOUT);
        long timeout = parseString(timeoutStr, defaultValue);
        return new PollTimeoutHeader(timeout);
    }
}
