Hisoka-X commented on code in PR #5561:
URL: https://github.com/apache/seatunnel/pull/5561#discussion_r1372666919
##########
seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSourceReader.java:
##########
@@ -87,40 +108,73 @@ public void close() throws IOException {
}
}
- @Override
- public void pollNext(Collector<SeaTunnelRow> output) throws Exception {
- try {
- HttpResponse response =
- httpClient.execute(
- this.httpParameter.getUrl(),
- this.httpParameter.getMethod().getMethod(),
- this.httpParameter.getHeaders(),
- this.httpParameter.getParams(),
- this.httpParameter.getBody());
- if (HttpResponse.STATUS_OK == response.getCode()) {
- String content = response.getContent();
- if (!Strings.isNullOrEmpty(content)) {
- if (this.httpParameter.isEnableMultilines()) {
- StringReader stringReader = new StringReader(content);
- BufferedReader bufferedReader = new
BufferedReader(stringReader);
- String lineStr;
- while ((lineStr = bufferedReader.readLine()) != null) {
- collect(output, lineStr);
- }
- } else {
- collect(output, content);
+ public void pollAndCollectData(Collector<SeaTunnelRow> output) throws
Exception {
+ HttpResponse response =
+ httpClient.execute(
+ this.httpParameter.getUrl(),
+ this.httpParameter.getMethod().getMethod(),
+ this.httpParameter.getHeaders(),
+ this.httpParameter.getParams(),
+ this.httpParameter.getBody());
+ if (HttpResponse.STATUS_OK == response.getCode()) {
+ String content = response.getContent();
+ if (!Strings.isNullOrEmpty(content)) {
+ if (this.httpParameter.isEnableMultilines()) {
+ StringReader stringReader = new StringReader(content);
+ BufferedReader bufferedReader = new
BufferedReader(stringReader);
+ String lineStr;
+ while ((lineStr = bufferedReader.readLine()) != null) {
+ collect(output, lineStr);
}
+ } else {
+ collect(output, content);
}
- return;
}
+ log.info(
+ "http client execute success request param:[{}], http
response status code:[{}], content:[{}]",
+ httpParameter.getParams(),
+ response.getCode(),
+ response.getContent());
+ } else {
log.error(
"http client execute exception, http response status
code:[{}], content:[{}]",
response.getCode(),
response.getContent());
+ }
+ }
+
+ private void updateRequestParam(PageInfo pageInfo) {
+ if (this.httpParameter.getParams() == null) {
+ httpParameter.setParams(new HashMap<>());
+ }
+ this.httpParameter
+ .getParams()
+ .put(pageInfo.getPageField(),
pageInfo.getPageIndex().toString());
+ //
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]