class HttpRangeHeaderParamConverter implements ParamConverter<RangeHeader> {

    @Override
    public RangeHeader fromString(String value) {
        // If the range request is completely empty, treat it as if it was never set
        if (value == null || value.isEmpty()) {
            return null;
        }
        final Matcher matcher = RANGE_REGEX.matcher(value);
        if (matcher.matches()) {
            final RangeHeader rangeHeader = new RangeHeader();
            rangeHeader.setUnit(matcher.group(1));
            rangeHeader.setStart(Long.parseLong(matcher.group(2)));
            if (matcher.group(3) != null) {
                rangeHeader.setEnd(Long.parseLong(matcher.group(3)));
            }
            return rangeHeader;
        }
        throw new WebApplicationException(String.format(RANGE_MSG_FORMATTER, value), Response.Status.BAD_REQUEST);
    }

      HttpRangeHeaderParamConverter();

}