Skip to content

Commit 1adfc0b

Browse files
committed
add warn for encoding
1 parent 10255be commit 1adfc0b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/produce/ProduceEventStreamProcessor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@
2727
import org.apache.commons.lang3.StringUtils;
2828
import org.apache.servicecomb.common.rest.codec.RestObjectMapperFactory;
2929
import org.apache.servicecomb.swagger.invocation.sse.SseEventResponseEntity;
30+
import org.slf4j.Logger;
31+
import org.slf4j.LoggerFactory;
3032

3133
import com.fasterxml.jackson.databind.JavaType;
3234

3335
import jakarta.ws.rs.core.MediaType;
3436

3537
public class ProduceEventStreamProcessor implements ProduceProcessor {
38+
private static final Logger LOGGER = LoggerFactory.getLogger(ProduceEventStreamProcessor.class);
39+
3640
public static final List<String> DEFAULT_DELIMITERS = Arrays.asList("\r\n", "\n", "\r");
3741

3842
@Override
@@ -55,6 +59,8 @@ public void doEncodeResponse(OutputStream output, Object result) throws Exceptio
5559
appendData(bufferBuilder, responseEntity.getData());
5660
bufferBuilder.append("\n");
5761
output.write(bufferBuilder.toString().getBytes(StandardCharsets.UTF_8));
62+
} else {
63+
LOGGER.warn("Does not support encoding objects other than SseEventResponseEntity!");
5864
}
5965
}
6066

0 commit comments

Comments
 (0)