001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.http;
014
015import org.apache.juneau.http.annotation.*;
016
017/**
018 * Represents a parsed <l>Accept-Range</l> HTTP response header.
019 *
020 * <p>
021 * What partial content range types this server supports via byte serving.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    Accept-Ranges: bytes
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a
031 * resource:
032 * <p class='bcode w800'>
033 *    Accept-Ranges     = "Accept-Ranges" ":" acceptable-ranges
034 *    acceptable-ranges = 1#range-unit | "none"
035 * </p>
036 *
037 * <p>
038 * Origin servers that accept byte-range requests MAY send...
039 * <p class='bcode w800'>
040 *    Accept-Ranges: bytes
041 * </p>
042 * <p>
043 * ...but are not required to do so.
044 *
045 * <p>
046 * Clients MAY generate byte-range requests without having received this header for the resource involved.
047 *
048 * <p>
049 * Range units are defined in section 3.12.
050 *
051 * <p>
052 * Servers that do not accept any kind of range request for a resource MAY send...
053 * <p class='bcode w800'>
054 *    Accept-Ranges: none
055 * </p>
056 * <p>
057 * ...to advise the client not to attempt a range request.
058 *
059 * <ul class='seealso'>
060 *    <li class='extlink'>{@doc RFC2616}
061 * </ul>
062 */
063@Header("Accept-Ranges")
064public final class AcceptRanges extends HeaderString {
065
066   /**
067    * Returns a parsed <c>Accept-Ranges</c> header.
068    *
069    * @param value The <c>Accept-Ranges</c> header string.
070    * @return The parsed <c>Accept-Ranges</c> header, or <jk>null</jk> if the string was null.
071    */
072   public static AcceptRanges forString(String value) {
073      if (value == null)
074         return null;
075      return new AcceptRanges(value);
076   }
077
078   private AcceptRanges(String value) {
079      super(value);
080   }
081}