20
20
import java .lang .annotation .Retention ;
21
21
import java .lang .annotation .RetentionPolicy ;
22
22
import java .lang .annotation .Target ;
23
+ import java .util .List ;
23
24
24
- import org .springframework .context .ApplicationContext ;
25
25
import org .springframework .context .annotation .Import ;
26
26
import org .springframework .hateoas .MediaTypes ;
27
27
import org .springframework .hateoas .support .WebStack ;
28
28
import org .springframework .http .MediaType ;
29
- import org .springframework .web .reactive .function .client .WebClient ;
30
29
31
30
/**
32
31
* Activates hypermedia support in the {@link ApplicationContext}. Will register infrastructure beans to support all
50
49
51
50
/**
52
51
* Configures which {@link WebStack}s we're supposed to enable support for. By default we're activating it for all
53
- * available ones if they happen to be in use. Configure this explicitly in case you're using WebFlux components
54
- * like {@link WebClient} but don't want to use hypermedia operations with it.
52
+ * available ones if they happen to be in use. Configure this explicitly in case you're using WebFlux components like
53
+ * {@link WebClient} but don't want to use hypermedia operations with it.
55
54
*
56
55
* @return
57
56
*/
@@ -69,9 +68,9 @@ enum HypermediaType {
69
68
* HAL - Hypermedia Application Language.
70
69
*
71
70
* @see http://stateless.co/hal_specification.html
72
- * @see https://tools.ietf.org/html/draft-kelly-json-hal-05
71
+ * @see https://tools.ietf.org/html/draft-kelly-json-hal
73
72
*/
74
- HAL (MediaTypes .HAL_JSON , "hal" ),
73
+ HAL (List . of ( MediaTypes .HAL_JSON , MediaTypes . VND_HAL_JSON ) , "hal" ),
75
74
76
75
/**
77
76
* HAL-FORMS - Independent, backward-compatible extension of the HAL designed to add runtime FORM support
@@ -96,18 +95,33 @@ enum HypermediaType {
96
95
*/
97
96
UBER (MediaTypes .UBER_JSON , "uber" );
98
97
99
- private final MediaType mediaTypes ;
98
+ private final List < MediaType > mediaTypes ;
100
99
private final String localPackageName ;
101
100
102
101
HypermediaType (MediaType mediaType , String localPackageName ) {
103
- this .mediaTypes = mediaType ;
102
+ this .mediaTypes = List . of ( mediaType ) ;
104
103
this .localPackageName = localPackageName ;
105
104
}
106
105
107
- public MediaType getMediaType () {
106
+ HypermediaType (List <MediaType > mediaTypes , String localPackageName ) {
107
+ this .mediaTypes = mediaTypes ;
108
+ this .localPackageName = localPackageName ;
109
+ }
110
+
111
+ public List <MediaType > getMediaTypes () {
108
112
return this .mediaTypes ;
109
113
}
110
114
115
+ /**
116
+ * @deprecated since 2.5, in favor of {@link #getMediaTypes()} as a logical media type might have been associated
117
+ * with multiple media type identifiers (see {@link #HAL}).
118
+ * @return will never be {@literal null}.
119
+ */
120
+ @ Deprecated (since = "2.5" , forRemoval = true )
121
+ public MediaType getMediaType () {
122
+ return this .mediaTypes .get (0 );
123
+ }
124
+
111
125
public String getLocalPackageName () {
112
126
return localPackageName ;
113
127
}
0 commit comments