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.util.function.*; 021 022/** 023 * Represents an HTTP <c>No-Trace</c> header. 024 * 025 * <p> 026 * When a request carries <c>No-Trace: true</c>, the server keeps the stack trace of a failed call out of its access-log 027 * record; the one-line record (status, method, path) is still logged. 028 * The <js>"NoTrace"</js> request attribute has the same effect and, when both are present, wins over the header. 029 * 030 * @since 9.2.1 031 */ 032public class NoTrace extends HttpBooleanHeader { 033 034 public static final String NAME = "No-Trace"; 035 036 public NoTrace(String value) { 037 super(NAME, value); 038 } 039 040 public NoTrace(boolean value) { 041 super(NAME, Boolean.valueOf(value)); 042 } 043 044 public NoTrace(Boolean value) { 045 super(NAME, value); 046 } 047 048 private NoTrace(Supplier<?> supplier, int lazyMode) { 049 super(NAME, supplier, lazyMode); 050 } 051 052 public static NoTrace of(String value) { 053 return new NoTrace(value); 054 } 055 056 public static NoTrace of(boolean value) { 057 return new NoTrace(value); 058 } 059 060 public static NoTrace of(Boolean value) { 061 return new NoTrace(value); 062 } 063 064 public static NoTrace ofLazyWire(Supplier<String> supplier) { 065 return new NoTrace(supplier, LAZY_WIRE_STRING); 066 } 067 068 public static NoTrace ofLazyParsed(Supplier<Boolean> supplier) { 069 return new NoTrace(supplier, LAZY_BOOLEAN); 070 } 071}