|
53 | 53 | @FluxCommand("open-http")
|
54 | 54 | public final class HttpOpener extends DefaultObjectPipe<String, ObjectReceiver<Reader>> {
|
55 | 55 |
|
56 |
| - public static final String ACCEPT_DEFAULT = "*/*"; |
57 | 56 | public static final String ACCEPT_HEADER = "accept";
|
58 |
| - public static final String CONTENT_TYPE_HEADER = "content-type"; |
| 57 | + public static final String ACCEPT_CHARSET_HEADER = "accept-charset"; |
59 | 58 | public static final String ACCEPT_ENCODING_HEADER = "accept-encoding";
|
60 |
| - public static final String ENCODING_HEADER = "content-encoding"; |
61 |
| - public static final String DEFAULT_PREFIX = "ERROR: "; |
| 59 | + public static final String CONTENT_ENCODING_HEADER = "content-encoding"; |
| 60 | + public static final String CONTENT_TYPE_HEADER = "content-type"; |
| 61 | + |
| 62 | + public static final String ACCEPT_DEFAULT = "*/*"; |
62 | 63 | public static final String CHARSET_DEFAULT = "UTF-8";
|
63 |
| - public static final String ACCEPT_CHARSET_HEADER = "accept-charset"; |
| 64 | + public static final String DEFAULT_PREFIX = "ERROR: "; |
| 65 | + public static final String HEADER_FIELD_SEPARATOR = "\n"; |
| 66 | + public static final String HEADER_VALUE_SEPARATOR = ":"; |
64 | 67 | public static final String INPUT_DESIGNATOR = "@-";
|
| 68 | + |
65 | 69 | public static final String DEFAULT_METHOD_NAME = "GET";
|
66 | 70 | public static final Method DEFAULT_METHOD = Method.valueOf(DEFAULT_METHOD_NAME);
|
67 |
| - public static final String HEADER_FIELD_SEPARATOR = "\n"; |
68 |
| - public static final String HEADER_VALUE_SEPARATOR = ":"; |
| 71 | + |
69 | 72 | private static final Pattern HEADER_FIELD_SEPARATOR_PATTERN = Pattern.compile(HEADER_FIELD_SEPARATOR);
|
70 | 73 | private static final Pattern HEADER_VALUE_SEPARATOR_PATTERN = Pattern.compile(HEADER_VALUE_SEPARATOR);
|
| 74 | + |
71 | 75 | private static final int ALLOWED_REDIRECTIONS = 3;
|
72 | 76 | private static final int CONNECTION_TIMEOUT = 11000;
|
| 77 | + |
73 | 78 | private final Map<String, String> headers = new HashMap<>();
|
| 79 | + |
74 | 80 | private Method method;
|
75 | 81 | private String body;
|
76 | 82 | private String errorPrefix;
|
@@ -199,16 +205,16 @@ public void setAcceptContentEncoding(final String contentEncoding) {
|
199 | 205 | }
|
200 | 206 |
|
201 | 207 | /**
|
202 |
| - * Sets the HTTP {@value ENCODING_HEADER} header value. This is the |
203 |
| - * content encoding for the HTTP GET. It enables HTTP compression. |
| 208 | + * Sets the HTTP {@value CONTENT_ENCODING_HEADER} header value. This is the |
| 209 | + * content encoding for the HTTP request. It enables HTTP compression. |
204 | 210 | * Allowed values are "gzip".
|
205 | 211 | * The default for the content encoding is null, which means "no compression".
|
206 | 212 | *
|
207 | 213 | * @param contentEncoding name of content encoding used for the content-encoding HTTP
|
208 | 214 | * header
|
209 | 215 | */
|
210 | 216 | public void setContentEncoding(final String contentEncoding) {
|
211 |
| - setHeader(ENCODING_HEADER, contentEncoding); |
| 217 | + setHeader(CONTENT_ENCODING_HEADER, contentEncoding); |
212 | 218 | }
|
213 | 219 |
|
214 | 220 | /**
|
|
0 commit comments