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 * <h5 class='section'>See Also:</h5> 060 * <ul class='doctree'> 061 * <li class='extlink'>{@doc RFC2616} 062 * </ul> 063 */ 064@Header("Accept-Ranges") 065public final class AcceptRanges extends HeaderString { 066 067 /** 068 * Returns a parsed <code>Accept-Ranges</code> header. 069 * 070 * @param value The <code>Accept-Ranges</code> header string. 071 * @return The parsed <code>Accept-Ranges</code> header, or <jk>null</jk> if the string was null. 072 */ 073 public static AcceptRanges forString(String value) { 074 if (value == null) 075 return null; 076 return new AcceptRanges(value); 077 } 078 079 private AcceptRanges(String value) { 080 super(value); 081 } 082}