Merge remote-tracking branch 'origin/jetty-9.2.x'

Conflicts:
	aggregates/jetty-all/pom.xml
	apache-jsp/pom.xml
	apache-jstl/pom.xml
	examples/async-rest/async-rest-jar/pom.xml
	examples/async-rest/async-rest-webapp/pom.xml
	examples/async-rest/pom.xml
	examples/embedded/pom.xml
	examples/pom.xml
	jetty-alpn/jetty-alpn-client/pom.xml
	jetty-alpn/jetty-alpn-server/pom.xml
	jetty-alpn/pom.xml
	jetty-annotations/pom.xml
	jetty-ant/pom.xml
	jetty-client/pom.xml
	jetty-continuation/pom.xml
	jetty-deploy/pom.xml
	jetty-distribution/pom.xml
	jetty-fcgi/fcgi-client/pom.xml
	jetty-fcgi/fcgi-server/pom.xml
	jetty-fcgi/pom.xml
	jetty-http-spi/pom.xml
	jetty-http/pom.xml
	jetty-io/pom.xml
	jetty-jaas/pom.xml
	jetty-jaspi/pom.xml
	jetty-jmx/pom.xml
	jetty-jndi/pom.xml
	jetty-jsp/pom.xml
	jetty-jspc-maven-plugin/pom.xml
	jetty-maven-plugin/pom.xml
	jetty-monitor/pom.xml
	jetty-nosql/pom.xml
	jetty-osgi/jetty-osgi-alpn/pom.xml
	jetty-osgi/jetty-osgi-boot-jsp/pom.xml
	jetty-osgi/jetty-osgi-boot-warurl/pom.xml
	jetty-osgi/jetty-osgi-boot/pom.xml
	jetty-osgi/jetty-osgi-httpservice/pom.xml
	jetty-osgi/jetty-osgi-npn/pom.xml
	jetty-osgi/pom.xml
	jetty-osgi/test-jetty-osgi-context/pom.xml
	jetty-osgi/test-jetty-osgi-webapp/pom.xml
	jetty-osgi/test-jetty-osgi/pom.xml
	jetty-plus/pom.xml
	jetty-proxy/pom.xml
	jetty-quickstart/pom.xml
	jetty-rewrite/pom.xml
	jetty-runner/pom.xml
	jetty-security/pom.xml
	jetty-server/pom.xml
	jetty-servlet/pom.xml
	jetty-servlets/pom.xml
	jetty-spdy/pom.xml
	jetty-spdy/spdy-alpn-tests/pom.xml
	jetty-spdy/spdy-client/pom.xml
	jetty-spdy/spdy-core/pom.xml
	jetty-spdy/spdy-example-webapp/pom.xml
	jetty-spdy/spdy-http-client-transport/pom.xml
	jetty-spdy/spdy-http-common/pom.xml
	jetty-spdy/spdy-http-server/pom.xml
	jetty-spdy/spdy-npn-tests/pom.xml
	jetty-spdy/spdy-server/pom.xml
	jetty-spring/pom.xml
	jetty-start/pom.xml
	jetty-util-ajax/pom.xml
	jetty-util/pom.xml
	jetty-webapp/pom.xml
	jetty-websocket/javax-websocket-client-impl/pom.xml
	jetty-websocket/javax-websocket-server-impl/pom.xml
	jetty-websocket/pom.xml
	jetty-websocket/websocket-api/pom.xml
	jetty-websocket/websocket-client/pom.xml
	jetty-websocket/websocket-common/pom.xml
	jetty-websocket/websocket-server/pom.xml
	jetty-websocket/websocket-servlet/pom.xml
	jetty-xml/pom.xml
	pom.xml
	tests/pom.xml
	tests/test-continuation/pom.xml
	tests/test-integration/pom.xml
	tests/test-loginservice/pom.xml
	tests/test-quickstart/pom.xml
	tests/test-sessions/pom.xml
	tests/test-sessions/test-hash-sessions/pom.xml
	tests/test-sessions/test-jdbc-sessions/pom.xml
	tests/test-sessions/test-sessions-common/pom.xml
	tests/test-webapps/pom.xml
	tests/test-webapps/test-jaas-webapp/pom.xml
	tests/test-webapps/test-jetty-webapp/pom.xml
	tests/test-webapps/test-jndi-webapp/pom.xml
	tests/test-webapps/test-mock-resources/pom.xml
	tests/test-webapps/test-proxy-webapp/pom.xml
	tests/test-webapps/test-servlet-spec/pom.xml
	tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml
	tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml
	tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml
	tests/test-webapps/test-webapp-rfc2616/pom.xml
This commit is contained in:
Greg Wilkins 2014-09-17 21:15:17 +10:00
commit 89d8ffa940
1 changed files with 35 additions and 18 deletions

View File

@ -650,12 +650,18 @@ public class HttpOutput extends ServletOutputStream implements Runnable
* @param httpContent The content to send
* @param callback The callback to use to notify success or failure
*/
public void sendContent(HttpContent httpContent, Callback callback) throws IOException
public void sendContent(HttpContent httpContent, Callback callback)
{
if (BufferUtil.hasContent(_aggregate))
throw new IOException("written");
{
callback.failed(new IOException("cannot sendContent() after write()"));
return;
}
if (_channel.isCommitted())
throw new IOException("committed");
{
callback.failed(new IOException("committed"));
return;
}
while (true)
{
@ -666,9 +672,12 @@ public class HttpOutput extends ServletOutputStream implements Runnable
continue;
break;
case ERROR:
throw new EofException(_onError);
callback.failed(new EofException(_onError));
return;
case CLOSED:
throw new EofException("Closed");
callback.failed(new EofException("Closed"));
return;
default:
throw new IllegalStateException();
}
@ -687,22 +696,30 @@ public class HttpOutput extends ServletOutputStream implements Runnable
return;
}
ReadableByteChannel rbc=httpContent.getReadableByteChannel();
if (rbc!=null)
try
{
if (LOG.isDebugEnabled())
LOG.debug("sendContent({}=={},{},direct={})",httpContent,rbc,callback,_channel.useDirectBuffers());
// Close of the rbc is done by the async sendContent
sendContent(rbc,callback);
return;
}
ReadableByteChannel rbc=httpContent.getReadableByteChannel();
if (rbc!=null)
{
if (LOG.isDebugEnabled())
LOG.debug("sendContent({}=={},{},direct={})",httpContent,rbc,callback,_channel.useDirectBuffers());
// Close of the rbc is done by the async sendContent
sendContent(rbc,callback);
return;
}
InputStream in = httpContent.getInputStream();
if ( in!=null )
InputStream in = httpContent.getInputStream();
if ( in!=null )
{
if (LOG.isDebugEnabled())
LOG.debug("sendContent({}=={},{},direct={})",httpContent,in,callback,_channel.useDirectBuffers());
sendContent(in,callback);
return;
}
}
catch(Throwable th)
{
if (LOG.isDebugEnabled())
LOG.debug("sendContent({}=={},{},direct={})",httpContent,in,callback,_channel.useDirectBuffers());
sendContent(in,callback);
callback.failed(th);
return;
}