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 015/** 016 * Represents a parsed <l>Accept-Range</l> HTTP response header. 017 * 018 * <p> 019 * What partial content range types this server supports via byte serving. 020 * 021 * <h5 class='figure'>Example</h5> 022 * <p class='bcode'> 023 * Accept-Ranges: bytes 024 * </p> 025 * 026 * <h5 class='topic'>RFC2616 Specification</h5> 027 * 028 * The Accept-Ranges response-header field allows the server to indicate its acceptance of range requests for a 029 * resource: 030 * <p class='bcode'> 031 * Accept-Ranges = "Accept-Ranges" ":" acceptable-ranges 032 * acceptable-ranges = 1#range-unit | "none" 033 * </p> 034 * 035 * <p> 036 * Origin servers that accept byte-range requests MAY send... 037 * <p class='bcode'> 038 * Accept-Ranges: bytes 039 * </p> 040 * <p> 041 * ...but are not required to do so. 042 * 043 * <p> 044 * Clients MAY generate byte-range requests without having received this header for the resource involved. 045 * 046 * <p> 047 * Range units are defined in section 3.12. 048 * 049 * <p> 050 * Servers that do not accept any kind of range request for a resource MAY send... 051 * <p class='bcode'> 052 * Accept-Ranges: none 053 * </p> 054 * <p> 055 * ...to advise the client not to attempt a range request. 056 * 057 * <h5 class='section'>See Also:</h5> 058 * <ul class='doctree'> 059 * <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a> 060 * </ul> 061 */ 062public final class AcceptRanges extends HeaderString { 063 064 /** 065 * Returns a parsed <code>Accept-Ranges</code> header. 066 * 067 * @param value The <code>Accept-Ranges</code> header string. 068 * @return The parsed <code>Accept-Ranges</code> header, or <jk>null</jk> if the string was null. 069 */ 070 public static AcceptRanges forString(String value) { 071 if (value == null) 072 return null; 073 return new AcceptRanges(value); 074 } 075 076 private AcceptRanges(String value) { 077 super(value); 078 } 079}