This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.redkale.net.http;
|
package org.redkale.net.http;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.*;
|
||||||
import org.redkale.util.Attribute;
|
import org.redkale.util.Attribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,11 +20,18 @@ public abstract class RestHttpServlet<T> extends HttpBaseServlet {
|
|||||||
protected abstract T currentUser(HttpRequest req) throws IOException;
|
protected abstract T currentUser(HttpRequest req) throws IOException;
|
||||||
|
|
||||||
protected void finishJson(final HttpResponse response, RestOutput output) throws IOException {
|
protected void finishJson(final HttpResponse response, RestOutput output) throws IOException {
|
||||||
if (output != null) {
|
if (output == null) {
|
||||||
response.addHeader(output.getHeaders());
|
response.finishJson(output);
|
||||||
response.addCookie(output.getCookies());
|
return;
|
||||||
|
}
|
||||||
|
response.addHeader(output.getHeaders());
|
||||||
|
response.addCookie(output.getCookies());
|
||||||
|
|
||||||
|
if (output.getResult() instanceof File) {
|
||||||
|
response.finish((File) output.getResult());
|
||||||
|
} else {
|
||||||
|
response.finishJson(output.getResult());
|
||||||
}
|
}
|
||||||
response.finishJson(output == null ? null : output.getResult());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finishJsResult(final HttpResponse response, final String var, RestOutput output) throws IOException {
|
protected void finishJsResult(final HttpResponse response, final String var, RestOutput output) throws IOException {
|
||||||
|
|||||||
Reference in New Issue
Block a user