1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2015 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.
29
29
30
30
/**
31
31
* Represents a MIME Type, as originally defined in RFC 2046 and subsequently used in
32
- * other Internet protocols including HTTP. This class however does not contain support
33
- * the q-parameters used in HTTP content negotiation. Those can be found in the sub-class
32
+ * other Internet protocols including HTTP.
33
+ *
34
+ * <p>This class, however, does not contain support for the q-parameters used
35
+ * in HTTP content negotiation. Those can be found in the sub-class
34
36
* {@code org.springframework.http.MediaType} in the {@code spring-web} module.
35
37
*
36
38
* <p>Consists of a {@linkplain #getType() type} and a {@linkplain #getSubtype() subtype}.
40
42
* @author Arjen Poutsma
41
43
* @author Juergen Hoeller
42
44
* @author Rossen Stoyanchev
45
+ * @author Sam Brannen
43
46
* @since 4.0
44
47
* @see MimeTypeUtils
45
48
*/
@@ -99,9 +102,10 @@ public class MimeType implements Comparable<MimeType>, Serializable {
99
102
100
103
/**
101
104
* Create a new {@code MimeType} for the given primary type.
102
- * <p>The {@linkplain #getSubtype() subtype} is set to "*", parameters empty.
105
+ * <p>The {@linkplain #getSubtype() subtype} is set to <code>"*"</code>,
106
+ * and the parameters are empty.
103
107
* @param type the primary type
104
- * @throws IllegalArgumentException if any of the parameters contain illegal characters
108
+ * @throws IllegalArgumentException if any of the parameters contains illegal characters
105
109
*/
106
110
public MimeType (String type ) {
107
111
this (type , WILDCARD_TYPE );
@@ -112,7 +116,7 @@ public MimeType(String type) {
112
116
* <p>The parameters are empty.
113
117
* @param type the primary type
114
118
* @param subtype the subtype
115
- * @throws IllegalArgumentException if any of the parameters contain illegal characters
119
+ * @throws IllegalArgumentException if any of the parameters contains illegal characters
116
120
*/
117
121
public MimeType (String type , String subtype ) {
118
122
this (type , subtype , Collections .<String , String >emptyMap ());
@@ -123,7 +127,7 @@ public MimeType(String type, String subtype) {
123
127
* @param type the primary type
124
128
* @param subtype the subtype
125
129
* @param charSet the character set
126
- * @throws IllegalArgumentException if any of the parameters contain illegal characters
130
+ * @throws IllegalArgumentException if any of the parameters contains illegal characters
127
131
*/
128
132
public MimeType (String type , String subtype , Charset charSet ) {
129
133
this (type , subtype , Collections .singletonMap (PARAM_CHARSET , charSet .name ()));
@@ -134,7 +138,7 @@ public MimeType(String type, String subtype, Charset charSet) {
134
138
* and allows for different parameter.
135
139
* @param other the other media type
136
140
* @param parameters the parameters, may be {@code null}
137
- * @throws IllegalArgumentException if any of the parameters contain illegal characters
141
+ * @throws IllegalArgumentException if any of the parameters contains illegal characters
138
142
*/
139
143
public MimeType (MimeType other , Map <String , String > parameters ) {
140
144
this (other .getType (), other .getSubtype (), parameters );
@@ -145,7 +149,7 @@ public MimeType(MimeType other, Map<String, String> parameters) {
145
149
* @param type the primary type
146
150
* @param subtype the subtype
147
151
* @param parameters the parameters, may be {@code null}
148
- * @throws IllegalArgumentException if any of the parameters contain illegal characters
152
+ * @throws IllegalArgumentException if any of the parameters contains illegal characters
149
153
*/
150
154
public MimeType (String type , String subtype , Map <String , String > parameters ) {
151
155
Assert .hasLength (type , "type must not be empty" );
@@ -215,25 +219,25 @@ protected String unquote(String s) {
215
219
216
220
/**
217
221
* Indicates whether the {@linkplain #getType() type} is the wildcard character
218
- * {@ code *} or not.
222
+ * < code> *</code> or not.
219
223
*/
220
224
public boolean isWildcardType () {
221
225
return WILDCARD_TYPE .equals (getType ());
222
226
}
223
227
224
228
/**
225
- * Indicates whether the {@linkplain #getSubtype() subtype} is the wildcard character
226
- * {@code *} or the wildcard character followed by a sufiix (e.g.
227
- * {@code *+xml}), or not .
228
- * @return whether the subtype is {@code *}
229
+ * Indicates whether the {@linkplain #getSubtype() subtype} is the wildcard
230
+ * character <code> *</code> or the wildcard character followed by a suffix
231
+ * (e.g. <code> *+xml</code>) .
232
+ * @return whether the subtype is a wildcard
229
233
*/
230
234
public boolean isWildcardSubtype () {
231
235
return WILDCARD_TYPE .equals (getSubtype ()) || getSubtype ().startsWith ("*+" );
232
236
}
233
237
234
238
/**
235
- * Indicates whether this media type is concrete, i.e. whether neither the type or
236
- * subtype is a wildcard character {@ code *} .
239
+ * Indicates whether this media type is concrete, i.e. whether neither the type
240
+ * nor the subtype is a wildcard character < code> *</code> .
237
241
* @return whether this media type is concrete
238
242
*/
239
243
public boolean isConcrete () {
0 commit comments