1616package com .hivemq .http ;
1717
1818import com .hivemq .http .error .ErrorType ;
19+ import jakarta .ws .rs .core .MediaType ;
20+ import org .jetbrains .annotations .NotNull ;
1921
2022import java .nio .charset .Charset ;
2123import java .nio .charset .StandardCharsets ;
@@ -28,27 +30,29 @@ enum METHOD {
2830 GET , POST , HEAD , PUT , DELETE , OPTIONS , CONNECT , TRACE , PATCH
2931 }
3032
31- String SLASH = "/" ;
32- String HTTP = "http" ;
33- String HTTPS = "https" ;
34- String PROTOCOL_SEP = "://" ;
35- String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss" ;
36- String HTTP_URL_REGEX = "https?:\\ /\\ /(?:w{1,3}\\ .)?[^\\ s.]+(?:\\ .[a-z]+)*(?::\\ d+)?((?:\\ /\\ w+)|(?:-\\ w+))*\\ /?(?![^<]*(?:<\\ /\\ w+>|\\ /?>))" ;
37- Charset DEFAULT_CHARSET = StandardCharsets .UTF_8 ;
38- String CONTENT_TYPE_HEADER = "Content-Type" ;
39- String USER_AGENT_HEADER = "User-Agent" ;
40- String CONTENT_ENCODING_HEADER = "Content-Encoding" ;
41- String LOCATION_HEADER = "Location" ;
42- String AUTH_HEADER = "Authorization" ;
43- String BASIC_AUTH_CHALLENGE_HEADER = "WWW-Authenticate" ;
44- String BEARER_TOKEN_HEADER = "Bearer %s" ;
45- String BASIC_AUTH_HEADER = "Basic %s" ;
46- String BASIC_AUTH_REALM = "Basic realm=\" %s\" " ;
47- String HTML_MIME_TYPE = "text/html" ;
48- String PLAIN_MIME_TYPE = "text/plain" ;
49- String JSON_MIME_TYPE = "application/json" ;
50- String BASE64_ENCODED_VALUE = "data:%s;base64,%s" ;
51- String DEFAULT_MIME_TYPE = HTML_MIME_TYPE ;
33+ @ NotNull String SLASH = "/" ;
34+ @ NotNull String HTTP = "http" ;
35+ @ NotNull String HTTPS = "https" ;
36+ @ NotNull String PROTOCOL_SEP = "://" ;
37+ @ NotNull String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss" ;
38+ @ NotNull String HTTP_URL_REGEX = "https?:\\ /\\ /(?:w{1,3}\\ .)?[^\\ s.]+(?:\\ .[a-z]+)*(?::\\ d+)?((?:\\ /\\ w+)|(?:-\\ w+))*\\ /?(?![^<]*(?:<\\ /\\ w+>|\\ /?>))" ;
39+ @ NotNull Charset DEFAULT_CHARSET = StandardCharsets .UTF_8 ;
40+ @ NotNull String CONTENT_TYPE_HEADER = "Content-Type" ;
41+ @ NotNull String USER_AGENT_HEADER = "User-Agent" ;
42+ @ NotNull String CONTENT_ENCODING_HEADER = "Content-Encoding" ;
43+ @ NotNull String LOCATION_HEADER = "Location" ;
44+ @ NotNull String AUTH_HEADER = "Authorization" ;
45+ @ NotNull String BASIC_AUTH_CHALLENGE_HEADER = "WWW-Authenticate" ;
46+ @ NotNull String BEARER_TOKEN_HEADER = "Bearer %s" ;
47+ @ NotNull String BASIC_AUTH_HEADER = "Basic %s" ;
48+ @ NotNull String BASIC_AUTH_REALM = "Basic realm=\" %s\" " ;
49+ @ NotNull String HTML_MIME_TYPE = "text/html" ;
50+ @ NotNull String PLAIN_MIME_TYPE = "text/plain" ;
51+ @ NotNull String JSON_MIME_TYPE = "application/json" ;
52+ @ NotNull String BASE64_ENCODED_VALUE = "data:%s;base64,%s" ;
53+ @ NotNull String DEFAULT_MIME_TYPE = HTML_MIME_TYPE ;
54+ @ NotNull String APPLICATION_PROBLEM_JSON_CHARSET_UTF_8 = "application/problem+json;charset=utf-8" ;
55+ @ NotNull MediaType APPLICATION_PROBLEM_JSON_TYPE = new MediaType ("application" , "problem+json" , "utf-8" );
5256
5357 int SC_CONTINUE = 100 ;
5458 int SC_SWITCHING_PROTOCOLS = 101 ;
@@ -92,7 +96,7 @@ enum METHOD {
9296 int SC_GATEWAY_TIMEOUT = 504 ;
9397 int SC_HTTP_VERSION_NOT_SUPPORTED = 505 ;
9498
95- Map <String ,String > MIME_MAP = new HashMap (){{
99+ @ NotNull Map <String ,String > MIME_MAP = new HashMap <> (){{
96100 put ("appcache" , "text/cache-manifest" );
97101 put ("css" , "text/css" );
98102 put ("woff" , "font/woff" );
0 commit comments