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.rest; 014 015import org.apache.juneau.internal.*; 016 017/** 018 * Represents the amount of detail to include in a log entry for HTTP requests and responses. 019 */ 020public enum RestCallLoggingDetail { 021 022 /** 023 * Log only the request and response status lines. 024 */ 025 SHORT, 026 027 /** 028 * Log status lines and also headers. 029 */ 030 MEDIUM, 031 032 /** 033 * Log status lines, headers, and bodies if available. 034 */ 035 LONG; 036 037 boolean isOneOf(RestCallLoggingDetail...values) { 038 for (RestCallLoggingDetail v : values) 039 if (v == this) 040 return true; 041 return false; 042 } 043 044 /** 045 * Retrieves this enum using case-insensitive matching. 046 * 047 * @param s The enum name to resolve. 048 * @return The resolved value. 049 */ 050 public static RestCallLoggingDetail fromString(String s) { 051 if (! StringUtils.isEmpty(s)) { 052 try { 053 return valueOf(s.toUpperCase()); 054 } catch (IllegalArgumentException e) {} 055 } 056 return null; 057 } 058}