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.remoteable; 014 015import static java.lang.annotation.ElementType.*; 016import static java.lang.annotation.RetentionPolicy.*; 017 018import java.lang.annotation.*; 019 020import org.apache.juneau.httppart.*; 021import org.apache.juneau.urlencoding.*; 022 023/** 024 * @deprecated Use {@link org.apache.juneau.http.annotation.Header} 025 */ 026@Deprecated 027@Documented 028@Target({PARAMETER,FIELD,METHOD}) 029@Retention(RUNTIME) 030@Inherited 031public @interface Header { 032 033 /** 034 * The HTTP header name. 035 * 036 * <p> 037 * A blank value (the default) indicates to reuse the bean property name when used on a request bean property. 038 * 039 * <p> 040 * The value should be either <js>"*"</js> to represent multiple name/value pairs, or a label that defines the 041 * header name. 042 * 043 * <p> 044 * A blank value (the default) has the following behavior: 045 * <ul class='spaced-list'> 046 * <li> 047 * If the data type is <code>NameValuePairs</code>, <code>Map</code>, or a bean, 048 * then it's the equivalent to <js>"*"</js> which will cause the value to be serialized as name/value pairs. 049 * 050 * <h5 class='figure'>Example:</h5> 051 * <p class='bcode'> 052 * <jc>// When used on a remote method parameter</jc> 053 * <ja>@Remoteable</ja>(path=<js>"/myproxy"</js>) 054 * <jk>public interface</jk> MyProxy { 055 * 056 * <jc>// Equivalent to @Header("*")</jc> 057 * <ja>@RemoteMethod</ja>(path=<js>"/mymethod"</js>) 058 * String myProxyMethod1(<ja>@Header</ja> Map<String,Object> headers); 059 * } 060 * 061 * <jc>// When used on a request bean method</jc> 062 * <jk>public interface</jk> MyRequestBean { 063 * 064 * <jc>// Equivalent to @Header("*")</jc> 065 * <ja>@Header</ja> 066 * Map<String,Object> getFoo(); 067 * } 068 * </p> 069 * </li> 070 * <li> 071 * If used on a request bean method, uses the bean property name. 072 * 073 * <h5 class='figure'>Example:</h5> 074 * <p class='bcode'> 075 * <jk>public interface</jk> MyRequestBean { 076 * 077 * <jc>// Equivalent to @Header("Foo")</jc> 078 * <ja>@Header</ja> 079 * <ja>@BeanProperty</ja>(<js>"Foo"</js>) 080 * String getFoo(); 081 * } 082 * </p> 083 * </li> 084 * </ul> 085 */ 086 String name() default ""; 087 088 /** 089 * A synonym for {@link #name()}. 090 * 091 * <p> 092 * Allows you to use shortened notation if you're only specifying the name. 093 */ 094 String value() default ""; 095 096 /** 097 * Skips this value if it's an empty string or empty collection/array. 098 * 099 * <p> 100 * Note that <jk>null</jk> values are already ignored. 101 */ 102 boolean skipIfEmpty() default false; 103 104 /** 105 * Specifies the {@link HttpPartSerializer} class used for serializing values to strings. 106 * 107 * <p> 108 * The default value defaults to the using the part serializer defined on the {@link RequestBean @RequestBean} annotation, 109 * then on the client which by default is {@link UrlEncodingSerializer}. 110 * 111 * <p> 112 * This annotation is provided to allow values to be custom serialized. 113 */ 114 Class<? extends HttpPartSerializer> serializer() default HttpPartSerializer.Null.class; 115}