@Documented @Target(value={PARAMETER,METHOD,TYPE}) @Retention(value=RUNTIME) @Inherited public @interface ResponseHeader
Annotation used to denote an HTTP response header.
Can be used in the following locations:
On server-side REST, this annotation can be applied to method parameters to identify them as an HTTP response header.
In this case, the annotation can only be applied to subclasses of type Value
.
The following examples show 3 different ways of accomplishing the same task of setting an HTTP header on a response:
On server-side REST, this annotation can also be applied to public methods of Response
-annotated methods.
Modifier and Type | Optional Element and Description |
---|---|
String[] |
_default
|
String[] |
_enum
|
String |
$ref
|
String[] |
api
Free-form value for the Swagger Header Object.
|
String |
cf
Synonym for
collectionFormat() . |
int[] |
code
The HTTP status (or statuses) of the response.
|
String |
collectionFormat
|
String[] |
d
Synonym for
description() . |
String[] |
description
|
String[] |
df
Synonym for
_default() . |
String[] |
e
Synonym for
_enum() . |
boolean |
emax
Synonym for
exclusiveMaximum() . |
boolean |
emin
Synonym for
exclusiveMinimum() . |
String[] |
ex
Synonym for
example() . |
String[] |
example
A serialized example of the parameter.
|
boolean |
exclusiveMaximum
|
boolean |
exclusiveMinimum
|
String |
f
Synonym for
format() . |
String |
format
|
Items |
items
|
String |
max
Synonym for
maximum() . |
long |
maxi
Synonym for
maxItems() . |
String |
maximum
|
long |
maxItems
|
long |
maxl
Synonym for
maxLength() . |
long |
maxLength
|
String |
min
Synonym for
minimum() . |
long |
mini
Synonym for
minItems() . |
String |
minimum
|
long |
minItems
|
long |
minl
Synonym for
minLength() . |
long |
minLength
|
String |
mo
Synonym for
multipleOf() . |
String |
multipleOf
|
String |
n
Synonym for
name() . |
String |
name
The HTTP header name.
|
String |
p
Synonym for
pattern() . |
String |
pattern
|
Class<? extends HttpPartSerializer> |
serializer
Specifies the
HttpPartSerializer class used for serializing values to strings. |
String |
t
Synonym for
type() . |
String |
type
|
boolean |
ui
Synonym for
uniqueItems() . |
boolean |
uniqueItems
|
String |
value
A synonym for
name() . |
public abstract int[] code
public abstract String value
name()
.
Allows you to use shortened notation if you're only specifying the name.
The following are completely equivalent ways of defining a response header:
public abstract Class<? extends HttpPartSerializer> serializer
HttpPartSerializer
class used for serializing values to strings.
Overrides for this part the part serializer defined on the REST resource which by default is OpenApiSerializer
.
public abstract String[] description
public abstract String[] d
description()
.public abstract String type
The type of the parameter.
The possible values are:
Static strings are defined in ParameterType
.
public abstract String format
The possible values are:
Static strings are defined in FormatType
.
public abstract String collectionFormat
Determines the format of the array if
Can only be used if
Possible values are:
Static strings are defined in CollectionFormatType
.
Note that for collections/arrays parameters with POJO element types, the input is broken into a string array before being converted into POJO elements.
public abstract String cf
collectionFormat()
.public abstract String $ref
Denotes a reference to a definition object.
public abstract String multipleOf
public abstract String mo
multipleOf()
.public abstract long maxLength
public abstract long maxl
maxLength()
.public abstract long minLength
public abstract long minl
minLength()
.public abstract String pattern
A string value is valid if it matches the specified regular expression pattern.
If validation fails during serialization or parsing, the part serializer/parser will throw a SchemaValidationException
.
Only allowed for the following types:
public abstract long maxItems
public abstract long maxi
maxItems()
.public abstract long minItems
public abstract long mini
minItems()
.public abstract boolean exclusiveMaximum
public abstract boolean emax
exclusiveMaximum()
.public abstract boolean exclusiveMinimum
public abstract boolean emin
exclusiveMinimum()
.public abstract boolean uniqueItems
public abstract boolean ui
uniqueItems()
.public abstract String[] df
_default()
.public abstract String[] example
This attribute defines a representation of the value that is used by
public abstract String[] api
This is a Overview > juneau-marshall > JSON Details > Simplified JSON object that makes up the swagger information for this field.
The following are completely equivalent ways of defining the swagger description of the Header object:
The reasons why you may want to use this field include:
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.