Factored common code.
This commit is contained in:
parent
c4f7d38e86
commit
8bf0fee80b
|
@ -57,23 +57,20 @@ public class HttpTransportOverFCGI implements HttpTransport
|
||||||
{
|
{
|
||||||
if (lastContent)
|
if (lastContent)
|
||||||
{
|
{
|
||||||
Generator.Result headersResult = generator.generateResponseHeaders(request, info.getStatus(), info.getReason(),
|
Generator.Result headersResult = generateResponseHeaders(info, Callback.Adapter.INSTANCE);
|
||||||
info.getHttpFields(), Callback.Adapter.INSTANCE);
|
Generator.Result contentResult = generateResponseContent(BufferUtil.EMPTY_BUFFER, true, callback);
|
||||||
Generator.Result contentResult = generator.generateResponseContent(request, BufferUtil.EMPTY_BUFFER, lastContent, aborted, callback);
|
|
||||||
flusher.flush(headersResult, contentResult);
|
flusher.flush(headersResult, contentResult);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Generator.Result headersResult = generator.generateResponseHeaders(request, info.getStatus(), info.getReason(),
|
Generator.Result headersResult = generateResponseHeaders(info, callback);
|
||||||
info.getHttpFields(), callback);
|
|
||||||
flusher.flush(headersResult);
|
flusher.flush(headersResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Generator.Result headersResult = generator.generateResponseHeaders(request, info.getStatus(), info.getReason(),
|
Generator.Result headersResult = generateResponseHeaders(info, Callback.Adapter.INSTANCE);
|
||||||
info.getHttpFields(), Callback.Adapter.INSTANCE);
|
Generator.Result contentResult = generateResponseContent(content, lastContent, callback);
|
||||||
Generator.Result contentResult = generator.generateResponseContent(request, content, lastContent, aborted, callback);
|
|
||||||
flusher.flush(headersResult, contentResult);
|
flusher.flush(headersResult, contentResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +85,7 @@ public class HttpTransportOverFCGI implements HttpTransport
|
||||||
{
|
{
|
||||||
if (lastContent)
|
if (lastContent)
|
||||||
{
|
{
|
||||||
Generator.Result result = generator.generateResponseContent(request, BufferUtil.EMPTY_BUFFER, lastContent, aborted, callback);
|
Generator.Result result = generateResponseContent(BufferUtil.EMPTY_BUFFER, true, callback);
|
||||||
flusher.flush(result);
|
flusher.flush(result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -99,7 +96,7 @@ public class HttpTransportOverFCGI implements HttpTransport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Generator.Result result = generator.generateResponseContent(request, content, lastContent, aborted, callback);
|
Generator.Result result = generateResponseContent(content, lastContent, callback);
|
||||||
flusher.flush(result);
|
flusher.flush(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +104,16 @@ public class HttpTransportOverFCGI implements HttpTransport
|
||||||
flusher.shutdown();
|
flusher.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Generator.Result generateResponseHeaders(HttpGenerator.ResponseInfo info, Callback callback)
|
||||||
|
{
|
||||||
|
return generator.generateResponseHeaders(request, info.getStatus(), info.getReason(), info.getHttpFields(), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Generator.Result generateResponseContent(ByteBuffer buffer, boolean lastContent, Callback callback)
|
||||||
|
{
|
||||||
|
return generator.generateResponseContent(request, buffer, lastContent, aborted, callback);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void abort()
|
public void abort()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue