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 020import java.net.*; 021import java.util.function.*; 022 023/** 024 * Represents an HTTP <c>Location</c> header. 025 * 026 * <p> 027 * The URI for redirection or creation of a new resource. 028 * 029 * @since 9.2.1 030 */ 031public class Location extends HttpUriHeader { 032 033 public static final String NAME = "Location"; 034 035 public Location(String value) { 036 super(NAME, value); 037 } 038 039 public Location(URI value) { 040 super(NAME, value); 041 } 042 043 private Location(Supplier<?> supplier, int lazyMode) { 044 super(NAME, supplier, lazyMode); 045 } 046 047 public static Location of(String value) { 048 return new Location(value); 049 } 050 051 public static Location of(URI value) { 052 return new Location(value); 053 } 054 055 public static Location ofLazyWire(Supplier<String> supplier) { 056 return new Location(supplier, LAZY_WIRE_STRING); 057 } 058 059 public static Location ofLazyParsed(Supplier<URI> supplier) { 060 return new Location(supplier, LAZY_URI); 061 } 062}