Package ninja.utils
Class HttpHeaderUtils
- java.lang.Object
-
- ninja.utils.HttpHeaderUtils
-
public class HttpHeaderUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description HttpHeaderUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getCharsetOfContentType(String rawContentType, String defaultEncoding)
A http content type should contain a character set like "application/json; charset=utf-8".static String
getCharsetOfContentTypeOrUtf8(String rawContentType)
A http content type should contain a character set like "application/json; charset=utf-8".static String
getContentTypeFromContentTypeAndCharacterSetting(String rawContentType)
A http content type should contain a character set like "application/json; charset=utf-8".
-
-
-
Method Detail
-
getContentTypeFromContentTypeAndCharacterSetting
public static String getContentTypeFromContentTypeAndCharacterSetting(String rawContentType)
A http content type should contain a character set like "application/json; charset=utf-8". If you only want to get "application/json" you can use this method. See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1- Parameters:
rawContentType
- "application/json; charset=utf-8" or "application/json"- Returns:
- only the contentType without charset. Eg "application/json"
-
getCharsetOfContentType
public static String getCharsetOfContentType(String rawContentType, String defaultEncoding)
A http content type should contain a character set like "application/json; charset=utf-8". If you only want to get the character set you can use this method. See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1- Parameters:
rawContentType
- "application/json; charset=utf-8" or "application/json"- Returns:
- only the character set like utf-8 OR the defaultEncoding when not set
-
getCharsetOfContentTypeOrUtf8
public static String getCharsetOfContentTypeOrUtf8(String rawContentType)
A http content type should contain a character set like "application/json; charset=utf-8". If you only want to get the character set you can use this method. See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1- Parameters:
rawContentType
- "application/json; charset=utf-8" or "application/json"- Returns:
- only the character set like utf-8 OR utf-8 when not set
-
-