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