Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2012-07-20 01:07:57 +0000
committerGreg Wilkins2012-07-20 01:07:57 +0000
commit154a926b1b4d7144f548363915e812076b41769b (patch)
tree6de34588f2de279959b3acb93cc8bff687423943 /jetty-http
parent796e240545be41b1777bfea924c57f53251733a3 (diff)
parent29fda3a7d87fdeb0aa0413e488d73cd261ed7ce1 (diff)
downloadorg.eclipse.jetty.project-154a926b1b4d7144f548363915e812076b41769b.tar.gz
org.eclipse.jetty.project-154a926b1b4d7144f548363915e812076b41769b.tar.xz
org.eclipse.jetty.project-154a926b1b4d7144f548363915e812076b41769b.zip
jetty-9 merge from jetty-8. Mostly compiling but some tests still failing.
Merge remote-tracking branch 'origin/jetty-8' into jetty-9 Conflicts: example-async-rest/async-rest-jar/pom.xml example-async-rest/async-rest-webapp/pom.xml example-async-rest/pom.xml example-jetty-embedded/pom.xml jetty-aggregate/jetty-all-server/pom.xml jetty-aggregate/jetty-all/pom.xml jetty-aggregate/jetty-client/pom.xml jetty-aggregate/jetty-plus/pom.xml jetty-aggregate/jetty-server/pom.xml jetty-aggregate/jetty-servlet/pom.xml jetty-aggregate/jetty-webapp/pom.xml jetty-aggregate/jetty-websocket/pom.xml jetty-aggregate/pom.xml jetty-ajp/pom.xml jetty-annotations/pom.xml jetty-client/pom.xml jetty-continuation/pom.xml jetty-deploy/pom.xml jetty-distribution/pom.xml jetty-http-spi/pom.xml jetty-http/pom.xml jetty-http/src/main/java/org/eclipse/jetty/http/HttpContent.java jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java jetty-http/src/main/java/org/eclipse/jetty/http/gzip/CompressedResponseWrapper.java jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipStream.java jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorClientTest.java jetty-io/pom.xml jetty-io/src/main/java/org/eclipse/jetty/io/AbstractBuffers.java jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java jetty-io/src/main/java/org/eclipse/jetty/io/AsyncEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/Buffer.java jetty-io/src/main/java/org/eclipse/jetty/io/BuffersFactory.java jetty-io/src/main/java/org/eclipse/jetty/io/ByteArrayBuffer.java jetty-io/src/main/java/org/eclipse/jetty/io/ByteArrayEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/ConnectedEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/Connection.java jetty-io/src/main/java/org/eclipse/jetty/io/PooledBuffers.java jetty-io/src/main/java/org/eclipse/jetty/io/bio/StreamEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/bio/StringEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/nio/ChannelEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java jetty-io/src/main/java/org/eclipse/jetty/io/nio/SslConnection.java jetty-io/src/test/java/org/eclipse/jetty/io/ChannelEndPointTest.java jetty-io/src/test/java/org/eclipse/jetty/io/bio/SocketEndPointTest.java jetty-io/src/test/java/org/eclipse/jetty/io/nio/SelectChannelEndPointSslTest.java jetty-io/src/test/java/org/eclipse/jetty/io/nio/SelectChannelEndPointTest.java jetty-jaspi/pom.xml jetty-jmx/pom.xml jetty-jndi/pom.xml jetty-jsp/pom.xml jetty-monitor/pom.xml jetty-nested/pom.xml jetty-nosql/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/pom.xml jetty-osgi/test-jetty-osgi/pom.xml jetty-overlay-deployer/pom.xml jetty-plus/pom.xml jetty-policy/pom.xml jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletTest.java jetty-rewrite/pom.xml jetty-security/pom.xml jetty-server/pom.xml jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java jetty-server/src/main/java/org/eclipse/jetty/server/AbstractHttpConnection.java jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannelState.java jetty-server/src/main/java/org/eclipse/jetty/server/Request.java jetty-server/src/main/java/org/eclipse/jetty/server/Response.java jetty-server/src/main/java/org/eclipse/jetty/server/Server.java jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java jetty-server/src/main/java/org/eclipse/jetty/server/handler/GzipHandler.java jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerTest.java jetty-server/src/test/java/org/eclipse/jetty/server/session/SessionHandlerTest.java jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLCloseTest.java jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSocketServerTest.java jetty-servlet/pom.xml jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java jetty-servlets/pom.xml jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java jetty-servlets/src/test/java/org/eclipse/jetty/servlets/IncludableGzipFilterTest.java jetty-servlets/src/test/java/org/eclipse/jetty/servlets/MultipartFilterTest.java jetty-spdy/pom.xml jetty-spdy/spdy-core/pom.xml jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/CompressionDictionary.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/CompressionFactory.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/Controller.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/ISession.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/IStream.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/IdleListener.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/Promise.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/PushSynInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/SessionException.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardCompressionFactory.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardStream.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StreamException.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/ByteBufferDataInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/BytesDataInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/DataInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/GoAwayInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Headers.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/HeadersInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/PingInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/ReplyInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/RstInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/SPDY.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/SPDYException.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Session.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/SessionFrameListener.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/SessionStatus.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Settings.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/SettingsInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/Stream.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/StreamFrameListener.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/StreamStatus.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/StringDataInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/SynInfo.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/api/server/ServerSessionFrameListener.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/ControlFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/ControlFrameType.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/DataFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/GoAwayFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/HeadersFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/NoOpFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/PingFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/RstStreamFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/SettingsFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/SynReplyFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/SynStreamFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/frames/WindowUpdateFrame.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/ControlFrameGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/DataFrameGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/Generator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/GoAwayGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersBlockGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/HeadersGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/NoOpGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/PingGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/RstStreamGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/SettingsGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/SynReplyGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/SynStreamGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/generator/WindowUpdateGenerator.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/ControlFrameBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/ControlFrameParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/DataFrameParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/GoAwayBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/HeadersBlockParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/HeadersBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/NoOpBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/Parser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/PingBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/RstStreamBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/SettingsBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/SynReplyBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/SynStreamBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/UnknownControlFrameBodyParser.java jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/parser/WindowUpdateBodyParser.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/AsyncTimeoutTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/StandardSessionTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/StandardStreamTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/api/ClientUsageTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/api/ServerUsageTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/DataGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/GoAwayGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/HeadersGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/NoOpGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/PingGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/RstStreamGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/SettingsGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/SynReplyGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/SynStreamGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/TestSPDYParserListener.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/frames/WindowUpdateGenerateParseTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/parser/LiveChromiumRequestParserTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/parser/ParseVersusCacheBenchmarkTest.java jetty-spdy/spdy-core/src/test/java/org/eclipse/jetty/spdy/parser/UnknownControlFrameTest.java jetty-spdy/spdy-jetty-http-webapp/pom.xml jetty-spdy/spdy-jetty-http-webapp/src/main/config/etc/jetty-spdy.xml jetty-spdy/spdy-jetty-http/pom.xml jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/HTTPSPDYServerConnector.java jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/PushStrategy.java jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPAsyncConnectionFactory.java jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnectionFactory.java jetty-spdy/spdy-jetty-http/src/test/java/org/eclipse/jetty/spdy/http/AbstractHTTPSPDYTest.java jetty-spdy/spdy-jetty-http/src/test/java/org/eclipse/jetty/spdy/http/ConcurrentStreamsTest.java jetty-spdy/spdy-jetty-http/src/test/java/org/eclipse/jetty/spdy/http/ProtocolNegotiationTest.java jetty-spdy/spdy-jetty/pom.xml jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/AsyncConnectionFactory.java jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncConnection.java jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/EmptyAsyncEndPoint.java jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYAsyncConnection.java jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYClient.java jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/SPDYServerConnector.java jetty-spdy/spdy-jetty/src/main/java/org/eclipse/jetty/spdy/ServerSPDYAsyncConnectionFactory.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/AbstractTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/ClosedStreamTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/FlowControlTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/GoAwayTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/HeadersTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/IdleTimeoutTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/PingTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/ProtocolViolationsTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/PushStreamTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/ResetStreamTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SPDYClientFactoryTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SPDYServerConnectorTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SSLEngineLeakTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SSLSynReplyTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SettingsTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SynDataReplyDataLoadTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/SynReplyTest.java jetty-spdy/spdy-jetty/src/test/java/org/eclipse/jetty/spdy/UnsupportedVersionTest.java jetty-start/pom.xml jetty-util/pom.xml jetty-util/src/main/java/org/eclipse/jetty/util/URIUtil.java jetty-webapp/pom.xml jetty-websocket/pom.xml jetty-websocket/src/main/java/org/eclipse/jetty/websocket/DeflateFrameExtension.java jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketHandler.java jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketServletRFCTest.java jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java jetty-xml/pom.xml jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java pom.xml test-continuation/pom.xml test-jetty-nested/pom.xml test-jetty-servlet/pom.xml test-jetty-servlet/src/main/java/Jetty400Repro.java test-jetty-servlet/src/main/java/org/eclipse/jetty/testing/HttpTester.java test-jetty-servlet/src/test/java/org/eclipse/jetty/testing/HttpTesterTest.java test-jetty-webapp/pom.xml tests/pom.xml tests/test-integration/pom.xml tests/test-loginservice/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-webapp-rfc2616/pom.xml
Diffstat (limited to 'jetty-http')
-rw-r--r--jetty-http/pom.xml5
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java4
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/gzip/AbstractCompressedStream.java344
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/gzip/CompressedResponseWrapper.java (renamed from jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipResponseWrapper.java)322
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipStream.java310
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java12
-rw-r--r--jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorClientTest.java10
-rw-r--r--jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java12
8 files changed, 526 insertions, 493 deletions
diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml
index e3be6ca356..63120db6ee 100644
--- a/jetty-http/pom.xml
+++ b/jetty-http/pom.xml
@@ -1,8 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>jetty-project</artifactId>
<groupId>org.eclipse.jetty</groupId>
- <version>9.0.0-SNAPSHOT</version>
+ <version>8.1.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-http</artifactId>
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
index fd23cd1f8e..8dc0a08369 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
@@ -898,14 +898,12 @@ public class HttpParser
buffer.position(buffer.position()-1);
String chars = BufferUtil.toDetailString(buffer);
BufferUtil.clear(buffer);
- throw new IOException(this+" Illegal characters: "+chars);
+ throw new IOException(this+" Extra data after oshut: "+chars);
}
}
return false;
}
-
-
// Request/response line
if (_state.ordinal()<State.HEADER.ordinal())
if (parseLine(buffer))
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/AbstractCompressedStream.java b/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/AbstractCompressedStream.java
new file mode 100644
index 0000000000..2b136cec6a
--- /dev/null
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/AbstractCompressedStream.java
@@ -0,0 +1,344 @@
+// ========================================================================
+// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+package org.eclipse.jetty.http.gzip;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.zip.DeflaterOutputStream;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.util.ByteArrayOutputStream2;
+
+/* ------------------------------------------------------------ */
+/**
+ * Skeletal implementation of a CompressedStream. This class adds compression features to a ServletOutputStream and takes care of setting response headers, etc.
+ * Major work and configuration is done here. Subclasses using different kinds of compression only have to implement the abstract methods doCompress() and
+ * setContentEncoding() using the desired compression and setting the appropriate Content-Encoding header string.
+ */
+public abstract class AbstractCompressedStream extends ServletOutputStream
+{
+ private final String _encoding;
+ protected HttpServletRequest _request;
+ protected HttpServletResponse _response;
+ protected OutputStream _out;
+ protected ByteArrayOutputStream2 _bOut;
+ protected DeflaterOutputStream _compressedOutputStream;
+ protected boolean _closed;
+ protected int _bufferSize;
+ protected int _minCompressSize;
+ protected long _contentLength;
+ protected boolean _doNotCompress;
+
+ /**
+ * Instantiates a new compressed stream.
+ *
+ * @param request
+ * the request
+ * @param response
+ * the response
+ * @param contentLength
+ * the content length
+ * @param bufferSize
+ * the buffer size
+ * @param minCompressSize
+ * the min compress size
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ public AbstractCompressedStream(String encoding,HttpServletRequest request, HttpServletResponse response, long contentLength, int bufferSize, int minCompressSize)
+ throws IOException
+ {
+ _encoding=encoding;
+ _request = request;
+ _response = response;
+ _contentLength = contentLength;
+ _bufferSize = bufferSize;
+ _minCompressSize = minCompressSize;
+ if (minCompressSize == 0)
+ doCompress();
+ }
+
+ /**
+ * Reset buffer.
+ */
+ public void resetBuffer()
+ {
+ if (_response.isCommitted())
+ throw new IllegalStateException("Committed");
+ _closed = false;
+ _out = null;
+ _bOut = null;
+ if (_compressedOutputStream != null)
+ _response.setHeader("Content-Encoding",null);
+ _compressedOutputStream = null;
+ _doNotCompress = false;
+ }
+
+ /**
+ * Sets the content length.
+ *
+ * @param length
+ * the new content length
+ */
+ public void setContentLength(long length)
+ {
+ _contentLength = length;
+ if (_doNotCompress && length >= 0)
+ {
+ if (_contentLength < Integer.MAX_VALUE)
+ _response.setContentLength((int)_contentLength);
+ else
+ _response.setHeader("Content-Length",Long.toString(_contentLength));
+ }
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @see java.io.OutputStream#flush()
+ */
+ @Override
+ public void flush() throws IOException
+ {
+ if (_out == null || _bOut != null)
+ {
+ if (_contentLength > 0 && _contentLength < _minCompressSize)
+ doNotCompress();
+ else
+ doCompress();
+ }
+
+ _out.flush();
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @see java.io.OutputStream#close()
+ */
+ @Override
+ public void close() throws IOException
+ {
+ if (_closed)
+ return;
+
+ if (_request.getAttribute("javax.servlet.include.request_uri") != null)
+ flush();
+ else
+ {
+ if (_bOut != null)
+ {
+ if (_contentLength < 0)
+ _contentLength = _bOut.getCount();
+ if (_contentLength < _minCompressSize)
+ doNotCompress();
+ else
+ doCompress();
+ }
+ else if (_out == null)
+ {
+ doNotCompress();
+ }
+
+ if (_compressedOutputStream != null)
+ _compressedOutputStream.close();
+ else
+ _out.close();
+ _closed = true;
+ }
+ }
+
+ /**
+ * Finish.
+ *
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ public void finish() throws IOException
+ {
+ if (!_closed)
+ {
+ if (_out == null || _bOut != null)
+ {
+ if (_contentLength > 0 && _contentLength < _minCompressSize)
+ doNotCompress();
+ else
+ doCompress();
+ }
+
+ if (_compressedOutputStream != null && !_closed)
+ {
+ _closed = true;
+ _compressedOutputStream.close();
+ }
+ }
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @see java.io.OutputStream#write(int)
+ */
+ @Override
+ public void write(int b) throws IOException
+ {
+ checkOut(1);
+ _out.write(b);
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @see java.io.OutputStream#write(byte[])
+ */
+ @Override
+ public void write(byte b[]) throws IOException
+ {
+ checkOut(b.length);
+ _out.write(b);
+ }
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @see java.io.OutputStream#write(byte[], int, int)
+ */
+ @Override
+ public void write(byte b[], int off, int len) throws IOException
+ {
+ checkOut(len);
+ _out.write(b,off,len);
+ }
+
+ /**
+ * Do compress.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public void doCompress() throws IOException
+ {
+ if (_compressedOutputStream==null)
+ {
+ if (_response.isCommitted())
+ throw new IllegalStateException();
+
+ setHeader("Content-Encoding", _encoding);
+ if (_response.containsHeader("Content-Encoding"))
+ {
+ _out=_compressedOutputStream=createStream();
+
+ if (_bOut!=null)
+ {
+ _out.write(_bOut.getBuf(),0,_bOut.getCount());
+ _bOut=null;
+ }
+ }
+ else
+ doNotCompress();
+ }
+ }
+
+ /**
+ * Do not compress.
+ *
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ public void doNotCompress() throws IOException
+ {
+ if (_compressedOutputStream != null)
+ throw new IllegalStateException("Compressed output stream is already assigned.");
+ if (_out == null || _bOut != null)
+ {
+ _doNotCompress = true;
+
+ _out = _response.getOutputStream();
+ setContentLength(_contentLength);
+
+ if (_bOut != null)
+ _out.write(_bOut.getBuf(),0,_bOut.getCount());
+ _bOut = null;
+ }
+ }
+
+ /**
+ * Check out.
+ *
+ * @param length
+ * the length
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ private void checkOut(int length) throws IOException
+ {
+ if (_closed)
+ throw new IOException("CLOSED");
+
+ if (_out == null)
+ {
+ if (_response.isCommitted() || (_contentLength >= 0 && _contentLength < _minCompressSize))
+ doNotCompress();
+ else if (length > _minCompressSize)
+ doCompress();
+ else
+ _out = _bOut = new ByteArrayOutputStream2(_bufferSize);
+ }
+ else if (_bOut != null)
+ {
+ if (_response.isCommitted() || (_contentLength >= 0 && _contentLength < _minCompressSize))
+ doNotCompress();
+ else if (length >= (_bOut.getBuf().length - _bOut.getCount()))
+ doCompress();
+ }
+ }
+
+ /**
+ * @see org.eclipse.jetty.http.gzip.CompressedStream#getOutputStream()
+ */
+ public OutputStream getOutputStream()
+ {
+ return _out;
+ }
+
+ /**
+ * @see org.eclipse.jetty.http.gzip.CompressedStream#isClosed()
+ */
+ public boolean isClosed()
+ {
+ return _closed;
+ }
+
+ /**
+ * Allows derived implementations to replace PrintWriter implementation.
+ */
+ protected PrintWriter newWriter(OutputStream out, String encoding) throws UnsupportedEncodingException
+ {
+ return encoding == null?new PrintWriter(out):new PrintWriter(new OutputStreamWriter(out,encoding));
+ }
+
+ protected void setHeader(String name,String value)
+ {
+ _response.setHeader(name, value);
+ }
+
+ /**
+ * Create the stream fitting to the underlying compression type.
+ *
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ protected abstract DeflaterOutputStream createStream() throws IOException;
+
+}
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipResponseWrapper.java b/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/CompressedResponseWrapper.java
index 8f2f673813..e439a9d511 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipResponseWrapper.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/CompressedResponseWrapper.java
@@ -1,17 +1,16 @@
// ========================================================================
-// Copyright (c) Webtide LLC
+// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
-// The Eclipse Public License is available at
+// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
-// You may elect to redistribute this code under either of these licenses.
+// You may elect to redistribute this code under either of these licenses.
// ========================================================================
-
package org.eclipse.jetty.http.gzip;
import java.io.IOException;
@@ -28,42 +27,34 @@ import javax.servlet.http.HttpServletResponseWrapper;
import org.eclipse.jetty.util.StringUtil;
-
-/* ------------------------------------------------------------ */
+/*------------------------------------------------------------ */
/**
*/
-public class GzipResponseWrapper extends HttpServletResponseWrapper
+public abstract class CompressedResponseWrapper extends HttpServletResponseWrapper
{
+
public static final int DEFAULT_BUFFER_SIZE = 8192;
- public static final int DEFAULT_MIN_GZIP_SIZE = 256;
-
- private final HttpServletRequest _request;
+ public static final int DEFAULT_MIN_COMPRESS_SIZE = 256;
+
private Set<String> _mimeTypes;
private int _bufferSize=DEFAULT_BUFFER_SIZE;
- private int _minGzipSize=DEFAULT_MIN_GZIP_SIZE;
+ private int _minCompressSize=DEFAULT_MIN_COMPRESS_SIZE;
+ protected HttpServletRequest _request;
private PrintWriter _writer;
- private GzipStream _gzStream;
+ private AbstractCompressedStream _compressedStream;
private long _contentLength=-1;
- private boolean _noGzip;
+ private boolean _noCompression;
- /**
- * Instantiates a new gzip response wrapper.
- *
- * @param request the request
- * @param response the response
- */
- public GzipResponseWrapper(HttpServletRequest request, HttpServletResponse response)
+ public CompressedResponseWrapper(HttpServletRequest request, HttpServletResponse response)
{
super(response);
- _request=request;
+ _request = request;
}
/* ------------------------------------------------------------ */
/**
- * Sets the mime types.
- *
- * @param mimeTypes the new mime types
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setMimeTypes(java.util.Set)
*/
public void setMimeTypes(Set<String> mimeTypes)
{
@@ -72,7 +63,7 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#setBufferSize(int)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setBufferSize(int)
*/
@Override
public void setBufferSize(int bufferSize)
@@ -82,80 +73,78 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
/* ------------------------------------------------------------ */
/**
- * Sets the min gzip size.
- *
- * @param minGzipSize the new min gzip size
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setMinCompressSize(int)
*/
- public void setMinGzipSize(int minGzipSize)
+ public void setMinCompressSize(int minCompressSize)
{
- _minGzipSize = minGzipSize;
+ _minCompressSize = minCompressSize;
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#setContentType(java.lang.String)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setContentType(java.lang.String)
*/
@Override
public void setContentType(String ct)
{
super.setContentType(ct);
-
+
if (ct!=null)
{
int colon=ct.indexOf(";");
if (colon>0)
ct=ct.substring(0,colon);
}
-
- if ((_gzStream==null || _gzStream._out==null) &&
- (_mimeTypes==null && "application/gzip".equalsIgnoreCase(ct) ||
- _mimeTypes!=null && (ct==null||!_mimeTypes.contains(StringUtil.asciiToLowerCase(ct)))))
+
+ if ((_compressedStream==null || _compressedStream.getOutputStream()==null) &&
+ (_mimeTypes==null && ct!=null && ct.contains("gzip") ||
+ _mimeTypes!=null && (ct==null||!_mimeTypes.contains(StringUtil.asciiToLowerCase(ct)))))
{
- noGzip();
+ noCompression();
}
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#setStatus(int, java.lang.String)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setStatus(int, java.lang.String)
*/
@Override
public void setStatus(int sc, String sm)
{
super.setStatus(sc,sm);
if (sc<200 || sc==204 || sc==205 || sc>=300)
- noGzip();
+ noCompression();
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#setStatus(int)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setStatus(int)
*/
@Override
public void setStatus(int sc)
{
super.setStatus(sc);
- if (sc<200 || sc==204 || sc==205 ||sc>=300)
- noGzip();
+ if (sc<200 || sc==204 || sc==205 || sc>=300)
+ noCompression();
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#setContentLength(int)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setContentLength(int)
*/
@Override
public void setContentLength(int length)
{
setContentLength((long)length);
}
-
+
/* ------------------------------------------------------------ */
protected void setContentLength(long length)
{
_contentLength=length;
- if (_gzStream!=null)
- _gzStream.setContentLength(length);
- else if (_noGzip && _contentLength>=0)
+ if (_compressedStream!=null)
+ _compressedStream.setContentLength(length);
+ else if (_noCompression && _contentLength>=0)
{
HttpServletResponse response = (HttpServletResponse)getResponse();
if(_contentLength<Integer.MAX_VALUE)
@@ -171,7 +160,7 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#addHeader(java.lang.String, java.lang.String)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#addHeader(java.lang.String, java.lang.String)
*/
@Override
public void addHeader(String name, String value)
@@ -179,19 +168,19 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
if ("content-length".equalsIgnoreCase(name))
{
_contentLength=Long.parseLong(value);
- if (_gzStream!=null)
- _gzStream.setContentLength(_contentLength);
+ if (_compressedStream!=null)
+ _compressedStream.setContentLength(_contentLength);
}
else if ("content-type".equalsIgnoreCase(name))
- {
+ {
setContentType(value);
}
else if ("content-encoding".equalsIgnoreCase(name))
- {
+ {
super.addHeader(name,value);
if (!isCommitted())
{
- noGzip();
+ noCompression();
}
}
else
@@ -200,96 +189,52 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#setHeader(java.lang.String, java.lang.String)
- */
- @Override
- public void setHeader(String name, String value)
- {
- if ("content-length".equalsIgnoreCase(name))
- {
- setContentLength(Long.parseLong(value));
- }
- else if ("content-type".equalsIgnoreCase(name))
- {
- setContentType(value);
- }
- else if ("content-encoding".equalsIgnoreCase(name))
- {
- super.setHeader(name,value);
- if (!isCommitted())
- {
- noGzip();
- }
- }
- else
- super.setHeader(name,value);
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see javax.servlet.http.HttpServletResponseWrapper#setIntHeader(java.lang.String, int)
- */
- @Override
- public void setIntHeader(String name, int value)
- {
- if ("content-length".equalsIgnoreCase(name))
- {
- _contentLength=value;
- if (_gzStream!=null)
- _gzStream.setContentLength(_contentLength);
- }
- else
- super.setIntHeader(name,value);
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see javax.servlet.ServletResponseWrapper#flushBuffer()
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#flushBuffer()
*/
@Override
public void flushBuffer() throws IOException
{
if (_writer!=null)
_writer.flush();
- if (_gzStream!=null)
- _gzStream.finish();
+ if (_compressedStream!=null)
+ _compressedStream.finish();
else
getResponse().flushBuffer();
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#reset()
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#reset()
*/
@Override
public void reset()
{
super.reset();
- if (_gzStream!=null)
- _gzStream.resetBuffer();
+ if (_compressedStream!=null)
+ _compressedStream.resetBuffer();
_writer=null;
- _gzStream=null;
- _noGzip=false;
+ _compressedStream=null;
+ _noCompression=false;
_contentLength=-1;
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#resetBuffer()
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#resetBuffer()
*/
@Override
public void resetBuffer()
{
super.resetBuffer();
- if (_gzStream!=null)
- _gzStream.resetBuffer();
+ if (_compressedStream!=null)
+ _compressedStream.resetBuffer();
_writer=null;
- _gzStream=null;
+ _compressedStream=null;
}
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#sendError(int, java.lang.String)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#sendError(int, java.lang.String)
*/
@Override
public void sendError(int sc, String msg) throws IOException
@@ -300,7 +245,7 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#sendError(int)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#sendError(int)
*/
@Override
public void sendError(int sc) throws IOException
@@ -311,7 +256,7 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.http.HttpServletResponseWrapper#sendRedirect(java.lang.String)
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#sendRedirect(java.lang.String)
*/
@Override
public void sendRedirect(String location) throws IOException
@@ -319,105 +264,130 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
resetBuffer();
super.sendRedirect(location);
}
-
+
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#getOutputStream()
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#noCompression()
*/
- @Override
- public ServletOutputStream getOutputStream() throws IOException
+ public void noCompression()
{
- if (_gzStream==null)
+ _noCompression=true;
+ if (_compressedStream!=null)
{
- if (getResponse().isCommitted() || _noGzip)
+ try
{
- setContentLength(_contentLength);
- return getResponse().getOutputStream();
+ _compressedStream.doNotCompress();
+ }
+ catch (IOException e)
+ {
+ throw new IllegalStateException(e);
}
-
- _gzStream=newGzipStream(_request,(HttpServletResponse)getResponse(),_contentLength,_bufferSize,_minGzipSize);
}
- else if (_writer!=null)
- throw new IllegalStateException("getWriter() called");
-
- return _gzStream;
}
-
+
+ /* ------------------------------------------------------------ */
+ /**
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#finish()
+ */
+ public void finish() throws IOException
+ {
+ if (_writer!=null && !_compressedStream.isClosed())
+ _writer.flush();
+ if (_compressedStream!=null)
+ _compressedStream.finish();
+ }
+
/* ------------------------------------------------------------ */
/**
- * @see javax.servlet.ServletResponseWrapper#getWriter()
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setHeader(java.lang.String, java.lang.String)
*/
@Override
- public PrintWriter getWriter() throws IOException
+ public void setHeader(String name, String value)
{
- if (_writer==null)
+ if ("content-length".equalsIgnoreCase(name))
{
- if (_gzStream!=null)
- throw new IllegalStateException("getOutputStream() called");
-
- if (getResponse().isCommitted() || _noGzip)
+ setContentLength(Long.parseLong(value));
+ }
+ else if ("content-type".equalsIgnoreCase(name))
+ {
+ setContentType(value);
+ }
+ else if ("content-encoding".equalsIgnoreCase(name))
+ {
+ super.setHeader(name,value);
+ if (!isCommitted())
{
- setContentLength(_contentLength);
- return getResponse().getWriter();
+ noCompression();
}
-
- _gzStream=newGzipStream(_request,(HttpServletResponse)getResponse(),_contentLength,_bufferSize,_minGzipSize);
- _writer=newWriter(_gzStream,getCharacterEncoding());
}
- return _writer;
+ else
+ super.setHeader(name,value);
}
-
+
/* ------------------------------------------------------------ */
/**
- * No gzip.
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#getOutputStream()
*/
- public void noGzip()
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException
{
- _noGzip=true;
- if (_gzStream!=null)
+ if (_compressedStream==null)
{
- try
- {
- _gzStream.doNotGzip();
- }
- catch (IOException e)
+ if (getResponse().isCommitted() || _noCompression)
{
- throw new IllegalStateException(e);
+ setContentLength(_contentLength);
+ return getResponse().getOutputStream();
}
+
+ _compressedStream=newCompressedStream(_request,(HttpServletResponse)getResponse(),_contentLength,_bufferSize,_minCompressSize);
}
+ else if (_writer!=null)
+ throw new IllegalStateException("getWriter() called");
+
+ return _compressedStream;
}
/* ------------------------------------------------------------ */
/**
- * Finish.
- *
- * @throws IOException Signals that an I/O exception has occurred.
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#getWriter()
*/
- public void finish() throws IOException
+ @Override
+ public PrintWriter getWriter() throws IOException
{
- if (_writer!=null && !_gzStream._closed)
- _writer.flush();
- if (_gzStream!=null)
- _gzStream.finish();
+ if (_writer==null)
+ {
+ if (_compressedStream!=null)
+ throw new IllegalStateException("getOutputStream() called");
+
+ if (getResponse().isCommitted() || _noCompression)
+ {
+ setContentLength(_contentLength);
+ return getResponse().getWriter();
+ }
+
+ _compressedStream=newCompressedStream(_request,(HttpServletResponse)getResponse(),_contentLength,_bufferSize,_minCompressSize);
+ _writer=newWriter(_compressedStream,getCharacterEncoding());
+ }
+ return _writer;
}
-
+
/* ------------------------------------------------------------ */
/**
- * Allows derived implementations to replace GzipStream implementation.
- *
- * @param request the request
- * @param response the response
- * @param contentLength the content length
- * @param bufferSize the buffer size
- * @param minGzipSize the min gzip size
- * @return the gzip stream
- * @throws IOException Signals that an I/O exception has occurred.
+ * @see org.eclipse.jetty.http.gzip.CompressedResponseWrapper#setIntHeader(java.lang.String, int)
*/
- protected GzipStream newGzipStream(HttpServletRequest request,HttpServletResponse response,long contentLength,int bufferSize, int minGzipSize) throws IOException
+ @Override
+ public void setIntHeader(String name, int value)
{
- return new GzipStream(request,response,contentLength,bufferSize,minGzipSize);
+ if ("content-length".equalsIgnoreCase(name))
+ {
+ _contentLength=value;
+ if (_compressedStream!=null)
+ _compressedStream.setContentLength(_contentLength);
+ }
+ else
+ super.setIntHeader(name,value);
}
-
+
/* ------------------------------------------------------------ */
/**
* Allows derived implementations to replace PrintWriter implementation.
@@ -431,5 +401,11 @@ public class GzipResponseWrapper extends HttpServletResponseWrapper
{
return encoding==null?new PrintWriter(out):new PrintWriter(new OutputStreamWriter(out,encoding));
}
-}
+
+ /* ------------------------------------------------------------ */
+ /**
+ *@return the underlying CompressedStream implementation
+ */
+ protected abstract AbstractCompressedStream newCompressedStream(HttpServletRequest _request, HttpServletResponse response, long _contentLength2, int _bufferSize2, int _minCompressedSize2) throws IOException;
+} \ No newline at end of file
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipStream.java b/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipStream.java
deleted file mode 100644
index 7f228f8b4d..0000000000
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/gzip/GzipStream.java
+++ /dev/null
@@ -1,310 +0,0 @@
-// ========================================================================
-// Copyright (c) Webtide LLC
-// ------------------------------------------------------------------------
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// and Apache License v2.0 which accompanies this distribution.
-// The Eclipse Public License is available at
-// http://www.eclipse.org/legal/epl-v10.html
-// The Apache License v2.0 is available at
-// http://www.opensource.org/licenses/apache2.0.php
-// You may elect to redistribute this code under either of these licenses.
-// ========================================================================
-
-
-package org.eclipse.jetty.http.gzip;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.zip.GZIPOutputStream;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.jetty.util.ByteArrayOutputStream2;
-
-
-/* ------------------------------------------------------------ */
-/**
- */
-public class GzipStream extends ServletOutputStream
-{
- protected HttpServletRequest _request;
- protected HttpServletResponse _response;
- protected OutputStream _out;
- protected ByteArrayOutputStream2 _bOut;
- protected GZIPOutputStream _gzOut;
- protected boolean _closed;
- protected int _bufferSize;
- protected int _minGzipSize;
- protected long _contentLength;
- protected boolean _doNotGzip;
-
- /**
- * Instantiates a new gzip stream.
- *
- * @param request the request
- * @param response the response
- * @param contentLength the content length
- * @param bufferSize the buffer size
- * @param minGzipSize the min gzip size
- * @throws IOException Signals that an I/O exception has occurred.
- */
- public GzipStream(HttpServletRequest request,HttpServletResponse response,long contentLength,int bufferSize, int minGzipSize) throws IOException
- {
- _request=request;
- _response=response;
- _contentLength=contentLength;
- _bufferSize=bufferSize;
- _minGzipSize=minGzipSize;
- if (minGzipSize==0)
- doGzip();
- }
-
- /**
- * Reset buffer.
- */
- public void resetBuffer()
- {
- if (_response.isCommitted())
- throw new IllegalStateException("Committed");
- _closed=false;
- _out=null;
- _bOut=null;
- if (_gzOut!=null)
- _response.setHeader("Content-Encoding",null);
- _gzOut=null;
- _doNotGzip=false;
- }
-
- /**
- * Sets the content length.
- *
- * @param length the new content length
- */
- public void setContentLength(long length)
- {
- _contentLength=length;
- if (_doNotGzip && length>=0)
- {
- if(_contentLength<Integer.MAX_VALUE)
- _response.setContentLength((int)_contentLength);
- else
- _response.setHeader("Content-Length",Long.toString(_contentLength));
- }
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see java.io.OutputStream#flush()
- */
- @Override
- public void flush() throws IOException
- {
- if (_out==null || _bOut!=null)
- {
- if (_contentLength>0 && _contentLength<_minGzipSize)
- doNotGzip();
- else
- doGzip();
- }
-
- _out.flush();
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see java.io.OutputStream#close()
- */
- @Override
- public void close() throws IOException
- {
- if (_closed)
- return;
-
- if (_request.getAttribute("javax.servlet.include.request_uri")!=null)
- flush();
- else
- {
- if (_bOut!=null)
- {
- if (_contentLength<0)
- _contentLength=_bOut.getCount();
- if (_contentLength<_minGzipSize)
- doNotGzip();
- else
- doGzip();
- }
- else if (_out==null)
- {
- doNotGzip();
- }
-
- if (_gzOut!=null)
- _gzOut.close();
- else
- _out.close();
- _closed=true;
- }
- }
-
- /**
- * Finish.
- *
- * @throws IOException Signals that an I/O exception has occurred.
- */
- public void finish() throws IOException
- {
- if (!_closed)
- {
- if (_out==null || _bOut!=null)
- {
- if (_contentLength>0 && _contentLength<_minGzipSize)
- doNotGzip();
- else
- doGzip();
- }
-
- if (_gzOut!=null && !_closed)
- {
- _closed=true;
- _gzOut.close();
- }
- }
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see java.io.OutputStream#write(int)
- */
- @Override
- public void write(int b) throws IOException
- {
- checkOut(1);
- _out.write(b);
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see java.io.OutputStream#write(byte[])
- */
- @Override
- public void write(byte b[]) throws IOException
- {
- checkOut(b.length);
- _out.write(b);
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- @Override
- public void write(byte b[], int off, int len) throws IOException
- {
- checkOut(len);
- _out.write(b,off,len);
- }
-
- /**
- * Sets the content encoding gzip.
- *
- * @return true, if successful
- */
- protected boolean setContentEncodingGzip()
- {
- _response.setHeader("Content-Encoding", "gzip");
- return _response.containsHeader("Content-Encoding");
- }
-
- /**
- * Do gzip.
- *
- * @throws IOException Signals that an I/O exception has occurred.
- */
- public void doGzip() throws IOException
- {
- if (_gzOut==null)
- {
- if (_response.isCommitted())
- throw new IllegalStateException();
-
- if (setContentEncodingGzip())
- {
- _out=_gzOut=new GZIPOutputStream(_response.getOutputStream(),_bufferSize);
-
- if (_bOut!=null)
- {
- _out.write(_bOut.getBuf(),0,_bOut.getCount());
- _bOut=null;
- }
- }
- else
- doNotGzip();
- }
- }
-
- /**
- * Do not gzip.
- *
- * @throws IOException Signals that an I/O exception has occurred.
- */
- public void doNotGzip() throws IOException
- {
- if (_gzOut!=null)
- throw new IllegalStateException();
- if (_out==null || _bOut!=null )
- {
- _doNotGzip = true;
-
- _out=_response.getOutputStream();
- setContentLength(_contentLength);
-
- if (_bOut!=null)
- _out.write(_bOut.getBuf(),0,_bOut.getCount());
- _bOut=null;
- }
- }
-
- /**
- * Check out.
- *
- * @param length the length
- * @throws IOException Signals that an I/O exception has occurred.
- */
- private void checkOut(int length) throws IOException
- {
- if (_closed)
- throw new IOException("CLOSED");
-
- if (_out==null)
- {
- if (_response.isCommitted() || (_contentLength>=0 && _contentLength<_minGzipSize))
- doNotGzip();
- else if (length>_minGzipSize)
- doGzip();
- else
- _out=_bOut=new ByteArrayOutputStream2(_bufferSize);
- }
- else if (_bOut!=null)
- {
- if (_response.isCommitted() || (_contentLength>=0 && _contentLength<_minGzipSize))
- doNotGzip();
- else if (length>=(_bOut.getBuf().length -_bOut.getCount()))
- doGzip();
- }
- }
-
- /**
- * Allows derived implementations to replace PrintWriter implementation.
- */
- protected PrintWriter newWriter(OutputStream out,String encoding) throws UnsupportedEncodingException
- {
- return encoding==null?new PrintWriter(out):new PrintWriter(new OutputStreamWriter(out,encoding));
- }
-}
-
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java
index 507d18e4d4..d165dd422f 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java
@@ -1,4 +1,16 @@
package org.eclipse.jetty.http.ssl;
+//========================================================================
+//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
+//------------------------------------------------------------------------
+//All rights reserved. This program and the accompanying materials
+//are made available under the terms of the Eclipse Public License v1.0
+//and Apache License v2.0 which accompanies this distribution.
+//The Eclipse Public License is available at
+//http://www.eclipse.org/legal/epl-v10.html
+//The Apache License v2.0 is available at
+//http://www.opensource.org/licenses/apache2.0.php
+//You may elect to redistribute this code under either of these licenses.
+//========================================================================
/* ------------------------------------------------------------ */
diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorClientTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorClientTest.java
index b4853848dc..3ed770cd22 100644
--- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorClientTest.java
+++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpGeneratorClientTest.java
@@ -14,17 +14,18 @@
package org.eclipse.jetty.http;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
import static org.junit.matchers.JUnitMatchers.containsString;
-
import java.nio.ByteBuffer;
+import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jetty.http.HttpGenerator.Action;
import org.eclipse.jetty.util.BufferUtil;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
public class HttpGeneratorClientTest
{
public final static String CONTENT="The quick brown fox jumped over the lazy dog.\nNow is the time for all good men to come to the aid of the party\nThe moon is blue to a fish in love.\n";
@@ -242,7 +243,7 @@ public class HttpGeneratorClientTest
assertTrue(head.endsWith("\r\n\r\n10\r\n"));
assertThat(body,containsString("dog"));
}
-
+
@Test
public void testRequestWithLargeChunkedContent() throws Exception
{
@@ -253,7 +254,6 @@ public class HttpGeneratorClientTest
HttpGenerator gen = new HttpGenerator();
gen.setLargeContent(8);
-
HttpGenerator.Result
result=gen.generate(null,null,null,null,content0,null);
diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java
index 1712024538..3e74dce3cc 100644
--- a/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java
+++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MimeTypesTest.java
@@ -1,4 +1,16 @@
package org.eclipse.jetty.http;
+//========================================================================
+//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
+//------------------------------------------------------------------------
+//All rights reserved. This program and the accompanying materials
+//are made available under the terms of the Eclipse Public License v1.0
+//and Apache License v2.0 which accompanies this distribution.
+//The Eclipse Public License is available at
+//http://www.eclipse.org/legal/epl-v10.html
+//The Apache License v2.0 is available at
+//http://www.opensource.org/licenses/apache2.0.php
+//You may elect to redistribute this code under either of these licenses.
+//========================================================================
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

Back to the top