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.header; 014 015import java.util.function.*; 016 017import org.apache.juneau.http.annotation.*; 018 019/** 020 * Represents a parsed <l>Server</l> HTTP response header. 021 * 022 * <p> 023 * A name for the server. 024 * 025 * <h5 class='figure'>Example</h5> 026 * <p class='bcode'> 027 * Server: Apache/2.4.1 (Unix) 028 * </p> 029 * 030 * <h5 class='topic'>RFC2616 Specification</h5> 031 * 032 * The Server response-header field contains information about the software used by the origin server to handle the 033 * request. 034 * The field can contain multiple product tokens (section 3.8) and comments identifying the server and any significant 035 * sub-products. 036 * The product tokens are listed in order of their significance for identifying the application. 037 * 038 * <p class='bcode'> 039 * Server = "Server" ":" 1*( product | comment ) 040 * </p> 041 * 042 * <p> 043 * Example: 044 * <p class='bcode'> 045 * Server: CERN/3.0 libwww/2.17 046 * </p> 047 * 048 * <p> 049 * If the response is being forwarded through a proxy, the proxy application MUST NOT modify the Server response-header. 050 * Instead, it SHOULD include a Via field (as described in section 14.45). 051 * 052 * <p> 053 * Note: Revealing the specific software version of the server might allow the server machine to become more vulnerable 054 * to attacks against software that is known to contain security holes. 055 * Server implementors are encouraged to make this field a configurable option. 056 * 057 * <h5 class='section'>See Also:</h5><ul> 058 * <li class='link'><a class="doclink" href="../../../../../index.html#juneau-rest-common">juneau-rest-common</a> 059 * <li class='extlink'><a class="doclink" href="https://www.w3.org/Protocols/rfc2616/rfc2616.html">Hypertext Transfer Protocol -- HTTP/1.1</a> 060 * </ul> 061 * 062 * @serial exclude 063 */ 064@Header("Server") 065public class Server extends BasicStringHeader { 066 067 //----------------------------------------------------------------------------------------------------------------- 068 // Static 069 //----------------------------------------------------------------------------------------------------------------- 070 071 private static final long serialVersionUID = 1L; 072 private static final String NAME = "Server"; 073 074 /** 075 * Static creator. 076 * 077 * @param value 078 * The header value. 079 * <br>Can be <jk>null</jk>. 080 * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>. 081 */ 082 public static Server of(String value) { 083 return value == null ? null : new Server(value); 084 } 085 086 /** 087 * Static creator with delayed value. 088 * 089 * <p> 090 * Header value is re-evaluated on each call to {@link #getValue()}. 091 * 092 * @param value 093 * The supplier of the header value. 094 * <br>Can be <jk>null</jk>. 095 * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>. 096 */ 097 public static Server of(Supplier<String> value) { 098 return value == null ? null : new Server(value); 099 } 100 101 //----------------------------------------------------------------------------------------------------------------- 102 // Instance 103 //----------------------------------------------------------------------------------------------------------------- 104 105 /** 106 * Constructor. 107 * 108 * @param value 109 * The header value. 110 * <br>Can be <jk>null</jk>. 111 */ 112 public Server(String value) { 113 super(NAME, value); 114 } 115 116 /** 117 * Constructor with delayed value. 118 * 119 * <p> 120 * Header value is re-evaluated on each call to {@link #getValue()}. 121 * 122 * @param value 123 * The supplier of the header value. 124 * <br>Can be <jk>null</jk>. 125 */ 126 public Server(Supplier<String> value) { 127 super(NAME, value); 128 } 129}