diff --git a/src/org/redkale/net/http/HttpResponse.java b/src/org/redkale/net/http/HttpResponse.java index 090c7749e..899c32ad0 100644 --- a/src/org/redkale/net/http/HttpResponse.java +++ b/src/org/redkale/net/http/HttpResponse.java @@ -16,6 +16,7 @@ import java.nio.file.*; import java.text.*; import java.util.*; import java.util.concurrent.atomic.*; +import org.redkale.convert.json.*; import org.redkale.net.*; import org.redkale.util.*; @@ -187,17 +188,27 @@ public class HttpResponse extends Response { } } - public void finishJson(Object obj) { + public void finishJson(final Object obj) { this.contentType = "text/plain; charset=utf-8"; finish(request.getJsonConvert().convertTo(context.getBufferSupplier(), obj)); } - public void finishJson(Type type, Object obj) { + public void finishJson(final JsonConvert convert, final Object obj) { + this.contentType = "text/plain; charset=utf-8"; + finish(convert.convertTo(context.getBufferSupplier(), obj)); + } + + public void finishJson(final Type type, final Object obj) { this.contentType = "text/plain; charset=utf-8"; finish(request.getJsonConvert().convertTo(context.getBufferSupplier(), type, obj)); } - public void finishJson(Object... objs) { + public void finishJson(final JsonConvert convert, final Type type, final Object obj) { + this.contentType = "text/plain; charset=utf-8"; + finish(convert.convertTo(context.getBufferSupplier(), type, obj)); + } + + public void finishJson(final Object... objs) { this.contentType = "text/plain; charset=utf-8"; finish(request.getJsonConvert().convertTo(context.getBufferSupplier(), objs)); }