This commit is contained in:
@@ -41,6 +41,8 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
|
|
||||||
protected boolean rpc;
|
protected boolean rpc;
|
||||||
|
|
||||||
|
protected Convert currConvert;
|
||||||
|
|
||||||
@Comment("Method GET/POST/...")
|
@Comment("Method GET/POST/...")
|
||||||
protected String method;
|
protected String method;
|
||||||
|
|
||||||
@@ -161,8 +163,8 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
return this.channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JsonConvert getJsonConvert() {
|
protected Convert getCurrConvert() {
|
||||||
return this.jsonConvert;
|
return this.currConvert == null ? this.jsonConvert : this.currConvert;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -662,6 +664,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
this.remoteAddr = null;
|
this.remoteAddr = null;
|
||||||
|
|
||||||
this.attachment = null;
|
this.attachment = null;
|
||||||
|
this.currConvert = jsonConvert;
|
||||||
|
|
||||||
this.headers.clear();
|
this.headers.clear();
|
||||||
this.params.clear();
|
this.params.clear();
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
public void finishJson(final Object obj) {
|
public void finishJson(final Object obj) {
|
||||||
this.contentType = this.jsonContentType;
|
this.contentType = this.jsonContentType;
|
||||||
if (this.recycleListener != null) this.output = obj;
|
if (this.recycleListener != null) this.output = obj;
|
||||||
finish(request.getJsonConvert().convertTo(getBodyBufferSupplier(), obj));
|
finish(request.getCurrConvert().convertTo(getBodyBufferSupplier(), obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -327,7 +327,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
public void finishMapJson(final Object... objs) {
|
public void finishMapJson(final Object... objs) {
|
||||||
this.contentType = this.jsonContentType;
|
this.contentType = this.jsonContentType;
|
||||||
if (this.recycleListener != null) this.output = objs;
|
if (this.recycleListener != null) this.output = objs;
|
||||||
finish(request.getJsonConvert().convertMapTo(getBodyBufferSupplier(), objs));
|
finish(request.getCurrConvert().convertMapTo(getBodyBufferSupplier(), objs));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -364,7 +364,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
public void finishJson(final Type type, final Object obj) {
|
public void finishJson(final Type type, final Object obj) {
|
||||||
this.contentType = this.jsonContentType;
|
this.contentType = this.jsonContentType;
|
||||||
this.output = obj;
|
this.output = obj;
|
||||||
finish(request.getJsonConvert().convertTo(getBodyBufferSupplier(), type, obj));
|
finish(request.getCurrConvert().convertTo(getBodyBufferSupplier(), type, obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -388,7 +388,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
public void finishJson(final Object... objs) {
|
public void finishJson(final Object... objs) {
|
||||||
this.contentType = this.jsonContentType;
|
this.contentType = this.jsonContentType;
|
||||||
if (this.recycleListener != null) this.output = objs;
|
if (this.recycleListener != null) this.output = objs;
|
||||||
finish(request.getJsonConvert().convertTo(getBodyBufferSupplier(), objs));
|
finish(request.getCurrConvert().convertTo(getBodyBufferSupplier(), objs));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -407,7 +407,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
this.header.addValue("retinfo", ret.getRetinfo());
|
this.header.addValue("retinfo", ret.getRetinfo());
|
||||||
}
|
}
|
||||||
Convert convert = ret == null ? null : ret.convert();
|
Convert convert = ret == null ? null : ret.convert();
|
||||||
if (convert == null) convert = request.getJsonConvert();
|
if (convert == null) convert = request.getCurrConvert();
|
||||||
finish(convert.convertTo(getBodyBufferSupplier(), ret));
|
finish(convert.convertTo(getBodyBufferSupplier(), ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
* @param future 输出对象的句柄
|
* @param future 输出对象的句柄
|
||||||
*/
|
*/
|
||||||
public void finishJson(final CompletableFuture future) {
|
public void finishJson(final CompletableFuture future) {
|
||||||
finish(request.getJsonConvert(), (Type) null, future);
|
finish(request.getCurrConvert(), (Type) null, future);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -489,7 +489,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void finish(final Object obj) {
|
public void finish(final Object obj) {
|
||||||
finish(request.getJsonConvert(), (Type) null, obj);
|
finish(request.getCurrConvert(), (Type) null, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user