001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 (the 006 * "License"); you may not use this file except in compliance with the 007 * License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.http.header; 018 019 020 021import java.util.function.*; 022 023import org.apache.juneau.commons.http.*; 024 025 026/** 027 * Represents an HTTP <c>Accept</c> header. 028 * 029 * <p> 030 * Content-Types that are acceptable for the response. 031 * 032 * @since 9.2.1 033 */ 034public class Accept extends HttpMediaRangesHeader { 035 036 public static final String NAME = "Accept"; 037 038 public Accept(String value) { 039 super(NAME, value); 040 } 041 042 public Accept(MediaRanges value) { 043 super(NAME, value); 044 } 045 046 private Accept(Supplier<?> supplier, int lazyMode) { 047 super(NAME, supplier, lazyMode); 048 } 049 050 public static Accept of(String value) { 051 return new Accept(value); 052 } 053 054 public static Accept of(MediaRanges value) { 055 return new Accept(value); 056 } 057 058 public static Accept ofLazyWire(Supplier<String> supplier) { 059 return new Accept(supplier, LAZY_WIRE_STRING); 060 } 061 062 public static Accept ofLazyParsed(Supplier<MediaRanges> supplier) { 063 return new Accept(supplier, LAZY_MEDIA_RANGES); 064 } 065}