1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
23
23
24
24
/**
25
25
* Defines a common interface for configuring either client or server HTTP
26
- * message readers and writers. To obtain an instance use either
27
- * {@link ClientCodecConfigurer#create()} or
28
- * {@link ServerCodecConfigurer#create()}.
26
+ * message readers and writers. This is used as follows:
27
+ * <ul>
28
+ * <li>Use {@link ClientCodecConfigurer#create()} or
29
+ * {@link ServerCodecConfigurer#create()} to create an instance.
30
+ * <li>Use {@link #defaultCodecs()} to customize HTTP message readers or writers
31
+ * registered by default.
32
+ * <li>Use {@link #customCodecs()} to add custom HTTP message readers or writers.
33
+ * <li>Use {@link #getReaders()} and {@link #getWriters()} to obtain the list of
34
+ * configured HTTP message readers and writers.
35
+ * </ul>
36
+ *
37
+ * <p>HTTP message readers and writers are divided into 3 categories that are
38
+ * ordered as follows:
39
+ * <ol>
40
+ * <li>Typed readers and writers that support specific types, e.g. byte[], String.
41
+ * <li>Object readers and writers, e.g. JSON, XML.
42
+ * <li>Catch-all readers or writers, e.g. String with any media type.
43
+ * </ol>
44
+ *
45
+ * <p>Typed and object readers are further sub-divided and ordered as follows:
46
+ * <ol>
47
+ * <li>Default HTTP reader and writer registrations.
48
+ * <li>Custom readers and writers.
49
+ * </ol>
29
50
*
30
51
* @author Rossen Stoyanchev
31
52
* @since 5.0
32
53
*/
33
54
public interface CodecConfigurer {
34
55
35
56
/**
36
- * Configure or customize the default HTTP message readers and writers.
57
+ * Provides a way to customize or replace HTTP message readers and writers
58
+ * registered by default.
59
+ * @see #registerDefaults(boolean)
37
60
*/
38
61
DefaultCodecs defaultCodecs ();
39
62
40
63
/**
41
- * Whether to register default HTTP message readers and writers.
42
- * <p>By default this is set to {@code "true"}; setting this to {@code false}
43
- * disables default HTTP message reader and writer registrations.
64
+ * Register custom HTTP message readers or writers in addition to the ones
65
+ * registered by default.
44
66
*/
45
- void registerDefaults ( boolean registerDefaults );
67
+ CustomCodecs customCodecs ( );
46
68
47
69
/**
48
- * Register custom HTTP message readers or writers to use in addition to
49
- * the ones registered by default.
70
+ * Provides a way to completely turn off registration of default HTTP message
71
+ * readers and writers, and instead rely only on the ones provided via
72
+ * {@link #customCodecs()}.
73
+ * <p>By default this is set to {@code "true"} in which case default
74
+ * registrations are made; setting this to {@code false} disables default
75
+ * registrations.
50
76
*/
51
- CustomCodecs customCodecs ();
77
+ void registerDefaults (boolean registerDefaults );
78
+
52
79
53
80
/**
54
81
* Obtain the configured HTTP message readers.
@@ -62,9 +89,10 @@ public interface CodecConfigurer {
62
89
63
90
64
91
/**
65
- * Assists with customizing the default HTTP message readers and writers.
66
- * @see ClientCodecConfigurer.ClientDefaultCodecs
67
- * @see ServerCodecConfigurer.ServerDefaultCodecs
92
+ * Customize or replace the HTTP message readers and writers registered by
93
+ * default. The options are further extended by
94
+ * {@link ClientCodecConfigurer.ClientDefaultCodecs ClientDefaultCodecs} and
95
+ * {@link ServerCodecConfigurer.ServerDefaultCodecs ServerDefaultCodecs}.
68
96
*/
69
97
interface DefaultCodecs {
70
98
@@ -85,7 +113,7 @@ interface DefaultCodecs {
85
113
86
114
87
115
/**
88
- * Registry and container for custom HTTP message readers and writers.
116
+ * Registry for custom HTTP message readers and writers.
89
117
*/
90
118
interface CustomCodecs {
91
119
0 commit comments