From 824509b0fb38b2e64a8125295d28734722d46893 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 10 Feb 2012 00:42:44 +1100 Subject: [PATCH] jetty-9 removed plurals from enum type names --- .../jetty/client/AbstractHttpConnection.java | 54 +++--- .../jetty/client/AsyncHttpConnection.java | 6 +- .../jetty/client/BlockingHttpConnection.java | 6 +- .../eclipse/jetty/client/CachedExchange.java | 6 +- .../eclipse/jetty/client/ContentExchange.java | 18 +- .../org/eclipse/jetty/client/HttpClient.java | 4 +- .../eclipse/jetty/client/HttpDestination.java | 18 +- .../jetty/client/HttpEventListener.java | 8 +- .../client/HttpEventListenerWrapper.java | 12 +- .../eclipse/jetty/client/HttpExchange.java | 60 +++---- .../jetty/client/RedirectListener.java | 18 +- .../eclipse/jetty/client/SelectConnector.java | 8 +- .../client/security/BasicAuthentication.java | 8 +- .../client/security/DigestAuthentication.java | 4 +- .../client/security/ProxyAuthorization.java | 8 +- .../client/security/SecurityListener.java | 12 +- .../jetty/client/webdav/MkcolExchange.java | 4 +- .../jetty/client/webdav/PropfindExchange.java | 4 +- .../jetty/client/webdav/WebdavListener.java | 12 +- .../webdav/WebdavSupportedExchange.java | 4 +- .../AbstractHttpExchangeCancelTest.java | 8 +- .../jetty/client/ContentExchangeTest.java | 10 +- .../java/org/eclipse/jetty/client/Curl.java | 16 +- .../eclipse/jetty/client/ErrorStatusTest.java | 8 +- .../jetty/client/Http100ContinueTest.java | 4 +- .../jetty/client/HttpExchangeTest.java | 38 ++-- .../jetty/client/HttpGetRedirectTest.java | 4 +- .../eclipse/jetty/client/HttpHeadersTest.java | 6 +- .../jetty/client/ProxyTunnellingTest.java | 18 +- .../jetty/client/SecurityListenerTest.java | 14 +- .../java/org/eclipse/jetty/client/Siege.java | 16 +- .../jetty/client/SluggishServerTest.java | 12 +- .../jetty/client/SslBytesClientTest.java | 4 +- .../jetty/client/SslBytesServerTest.java | 4 +- .../jetty/client/SslSecurityListenerTest.java | 4 +- .../jetty/client/TimeoutExchangeTest.java | 14 +- .../jetty/client/UnexpectedDataTest.java | 4 +- .../jetty/client/WebSocketUpgradeTest.java | 10 +- .../jetty/client/WebdavListenerTest.java | 10 +- .../helperClasses/GenericServerHandler.java | 4 +- .../eclipse/jetty/http/AbstractGenerator.java | 47 ++--- .../eclipse/jetty/http/EncodedHttpURI.java | 4 +- .../org/eclipse/jetty/http/Generator.java | 8 +- .../org/eclipse/jetty/http/HttpBuffers.java | 2 - .../org/eclipse/jetty/http/HttpFields.java | 25 ++- .../org/eclipse/jetty/http/HttpGenerator.java | 166 +++++++++--------- .../{HttpHeaders.java => HttpHeader.java} | 10 +- ...HeaderValues.java => HttpHeaderValue.java} | 20 +-- .../{HttpMethods.java => HttpMethod.java} | 8 +- .../org/eclipse/jetty/http/HttpParser.java | 40 ++--- .../{HttpSchemes.java => HttpScheme.java} | 8 +- .../java/org/eclipse/jetty/http/HttpURI.java | 4 +- .../{HttpVersions.java => HttpVersion.java} | 8 +- .../java/org/eclipse/jetty/http/Parser.java | 45 ----- .../java/org/eclipse/jetty/http/PathMap.java | 1 - .../eclipse/jetty/http/HttpFieldsTest.java | 7 +- .../jetty/http/HttpGeneratorClientTest.java | 34 ++-- .../eclipse/jetty/http/HttpGeneratorTest.java | 24 +-- .../eclipse/jetty/http/HttpParserTest.java | 3 - .../jetty/http/HttpStatusCodeTest.java | 2 +- .../jetty/server/AbstractConnector.java | 24 +-- .../jetty/server/AbstractHttpConnection.java | 112 ++++++------ .../org/eclipse/jetty/server/HttpInput.java | 6 +- .../org/eclipse/jetty/server/HttpOutput.java | 4 +- .../eclipse/jetty/server/NCSARequestLog.java | 8 +- .../org/eclipse/jetty/server/Request.java | 34 ++-- .../eclipse/jetty/server/ResourceCache.java | 36 ++-- .../org/eclipse/jetty/server/Response.java | 112 ++++++------ .../jetty/server/bio/SocketConnector.java | 4 +- .../jetty/server/handler/ConnectHandler.java | 26 +-- .../jetty/server/handler/ContextHandler.java | 4 +- .../jetty/server/handler/DefaultHandler.java | 14 +- .../jetty/server/handler/ErrorHandler.java | 8 +- .../jetty/server/handler/GzipHandler.java | 4 +- .../server/handler/MovedContextHandler.java | 6 +- .../jetty/server/handler/ResourceHandler.java | 24 +-- .../server/nio/BlockingChannelConnector.java | 14 +- .../jetty/server/ssl/SslCertificates.java | 4 +- .../server/ssl/SslSelectChannelConnector.java | 4 +- .../jetty/server/ssl/SslSocketConnector.java | 4 +- .../org/eclipse/jetty/server/DumpHandler.java | 4 +- .../jetty/server/HttpConnectionTest.java | 4 +- .../eclipse/jetty/server/HttpWriterTest.java | 8 +- .../server/NetworkTrafficListenerTest.java | 22 +-- .../eclipse/jetty/server/ResponseTest.java | 6 +- .../server/handler/ConnectHandlerTest.java | 6 +- .../org/eclipse/jetty/util/StringMap.java | 2 +- .../jetty/websocket/AbstractExtension.java | 4 +- .../websocket/DeflateFrameExtension.java | 4 +- .../jetty/websocket/WebSocketBuffers.java | 8 +- .../websocket/WebSocketClientFactory.java | 12 +- .../jetty/websocket/WebSocketConnection.java | 4 +- .../websocket/WebSocketConnectionD00.java | 8 +- .../websocket/WebSocketConnectionD06.java | 6 +- .../websocket/WebSocketConnectionD08.java | 6 +- .../websocket/WebSocketConnectionRFC6455.java | 6 +- .../websocket/WebSocketGeneratorD00.java | 4 +- .../websocket/WebSocketGeneratorD06.java | 4 +- .../websocket/WebSocketGeneratorD08.java | 6 +- .../websocket/WebSocketGeneratorRFC6455.java | 8 +- .../jetty/websocket/WebSocketParser.java | 8 +- .../jetty/websocket/WebSocketParserD00.java | 10 +- .../jetty/websocket/WebSocketParserD06.java | 10 +- .../jetty/websocket/WebSocketParserD08.java | 14 +- .../websocket/WebSocketParserRFC6455.java | 12 +- .../jetty/websocket/WebSocketLoadD08Test.java | 6 +- .../websocket/WebSocketLoadRFC6455Test.java | 6 +- .../websocket/WebSocketMessageD06Test.java | 6 +- .../websocket/WebSocketMessageD08Test.java | 6 +- .../WebSocketMessageRFC6455Test.java | 6 +- .../websocket/WebSocketParserD00Test.java | 10 +- .../websocket/WebSocketParserD06Test.java | 12 +- .../websocket/WebSocketParserD08Test.java | 12 +- .../websocket/WebSocketParserRFC6455Test.java | 12 +- pom.xml | 2 +- 115 files changed, 804 insertions(+), 860 deletions(-) rename jetty-http/src/main/java/org/eclipse/jetty/http/{HttpHeaders.java => HttpHeader.java} (94%) rename jetty-http/src/main/java/org/eclipse/jetty/http/{HttpHeaderValues.java => HttpHeaderValue.java} (79%) rename jetty-http/src/main/java/org/eclipse/jetty/http/{HttpMethods.java => HttpMethod.java} (89%) rename jetty-http/src/main/java/org/eclipse/jetty/http/{HttpSchemes.java => HttpScheme.java} (89%) rename jetty-http/src/main/java/org/eclipse/jetty/http/{HttpVersions.java => HttpVersion.java} (90%) delete mode 100644 jetty-http/src/main/java/org/eclipse/jetty/http/Parser.java diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index 51a4b53560c..60fbf120751 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -21,15 +21,15 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.jetty.client.security.Authentication; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpGenerator; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpParser; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.http.HttpVersions; +import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.io.AbstractConnection; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; @@ -55,7 +55,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen protected HttpParser _parser; protected boolean _http11 = true; protected int _status; - protected Buffer _connectionHeader; + protected ByteBuffer _connectionHeader; protected boolean _reserved; // The current exchange waiting for a response @@ -182,13 +182,13 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen String uri = _exchange.getRequestURI(); if (_destination.isProxied()) { - if (!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")) + if (!HttpMethod.CONNECT.equals(method) && uri.startsWith("/")) { boolean secure = _destination.isSecure(); String host = _destination.getAddress().getHost(); int port = _destination.getAddress().getPort(); StringBuilder absoluteURI = new StringBuilder(); - absoluteURI.append(secure ? HttpSchemes.HTTPS : HttpSchemes.HTTP); + absoluteURI.append(secure ? HttpScheme.HTTPS : HttpScheme.HTTP); absoluteURI.append("://"); absoluteURI.append(host); // Avoid adding default ports @@ -203,19 +203,19 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } _generator.setRequest(method, uri); - _parser.setHeadResponse(HttpMethods.HEAD.equalsIgnoreCase(method)); + _parser.setHeadResponse(HttpMethod.HEAD.equalsIgnoreCase(method)); HttpFields requestHeaders = _exchange.getRequestFields(); - if (_exchange.getVersion() >= HttpVersions.HTTP_1_1_ORDINAL) + if (_exchange.getVersion() >= HttpVersion.HTTP_1_1_ORDINAL) { - if (!requestHeaders.containsKey(HttpHeaders.HOST_BUFFER)) - requestHeaders.add(HttpHeaders.HOST_BUFFER,_destination.getHostHeader()); + if (!requestHeaders.containsKey(HttpHeader.HOST_BUFFER)) + requestHeaders.add(HttpHeader.HOST_BUFFER,_destination.getHostHeader()); } - Buffer requestContent = _exchange.getRequestContent(); + ByteBuffer requestContent = _exchange.getRequestContent(); if (requestContent != null) { - requestHeaders.putLongField(HttpHeaders.CONTENT_LENGTH, requestContent.length()); + requestHeaders.putLongField(HttpHeader.CONTENT_LENGTH, requestContent.length()); _generator.completeHeader(requestHeaders,false); _generator.addContent(new View(requestContent),true); } @@ -237,7 +237,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } else { - requestHeaders.remove(HttpHeaders.CONTENT_LENGTH); + requestHeaders.remove(HttpHeader.CONTENT_LENGTH); _generator.completeHeader(requestHeaders, true); } } @@ -258,7 +258,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen private class Handler extends HttpParser.EventHandler { @Override - public void startRequest(Buffer method, Buffer url, Buffer version) throws IOException + public void startRequest(ByteBuffer method, ByteBuffer url, ByteBuffer version) throws IOException { // System.out.println( method.toString() + "///" + url.toString() + // "///" + version.toString() ); @@ -268,7 +268,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } @Override - public void startResponse(Buffer version, int status, Buffer reason) throws IOException + public void startResponse(ByteBuffer version, int status, ByteBuffer reason) throws IOException { HttpExchange exchange = _exchange; if (exchange==null) @@ -288,12 +288,12 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen case HttpStatus.OK_200: // handle special case for CONNECT 200 responses - if (HttpMethods.CONNECT.equalsIgnoreCase(exchange.getMethod())) + if (HttpMethod.CONNECT.equalsIgnoreCase(exchange.getMethod())) _parser.setHeadResponse(true); break; } - _http11 = HttpVersions.HTTP_1_1_BUFFER.equals(version); + _http11 = HttpVersion.HTTP_1_1_BUFFER.equals(version); _status=status; exchange.getEventListener().onResponseStatus(version,status,reason); exchange.setStatus(HttpExchange.STATUS_PARSING_HEADERS); @@ -301,14 +301,14 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } @Override - public void parsedHeader(Buffer name, Buffer value) throws IOException + public void parsedHeader(ByteBuffer name, ByteBuffer value) throws IOException { HttpExchange exchange = _exchange; if (exchange!=null) { - if (HttpHeaders.CACHE.getOrdinal(name) == HttpHeaders.CONNECTION_ORDINAL) + if (HttpHeader.CACHE.getOrdinal(name) == HttpHeader.CONNECTION_ORDINAL) { - _connectionHeader = HttpHeaderValues.CACHE.lookup(value); + _connectionHeader = HttpHeaderValue.CACHE.lookup(value); } exchange.getEventListener().onResponseHeader(name,value); } @@ -323,7 +323,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } @Override - public void content(Buffer ref) throws IOException + public void content(ByteBuffer ref) throws IOException { HttpExchange exchange = _exchange; if (exchange!=null) @@ -511,12 +511,12 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } /* ------------------------------------------------------------ */ - public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + public void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { } /* ------------------------------------------------------------ */ - public void onResponseHeader(Buffer name, Buffer value) throws IOException + public void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { _next.onResponseHeader(name,value); } @@ -528,7 +528,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen } /* ------------------------------------------------------------ */ - public void onResponseContent(Buffer content) throws IOException + public void onResponseContent(ByteBuffer content) throws IOException { } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java index 455edfbeb92..293f126fc4a 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AsyncHttpConnection.java @@ -18,7 +18,7 @@ import java.io.IOException; import org.eclipse.jetty.http.AbstractGenerator; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -36,7 +36,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async private static final Logger LOG = Log.getLogger(AsyncHttpConnection.class); private boolean _requestComplete; - private Buffer _requestContentChunk; + private ByteBuffer _requestContentChunk; private final AsyncEndPoint _asyncEndp; AsyncHttpConnection(Buffers requestBuffers, Buffers responseBuffers, EndPoint endp) @@ -106,7 +106,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async { LOG.debug("addChunk"); progress=true; - Buffer chunk=_requestContentChunk; + ByteBuffer chunk=_requestContentChunk; _requestContentChunk=exchange.getRequestContentChunk(null); _generator.addContent(chunk,_requestContentChunk==null); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/BlockingHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/BlockingHttpConnection.java index d241699bdac..f95d967dcec 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/BlockingHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/BlockingHttpConnection.java @@ -18,7 +18,7 @@ import java.io.InterruptedIOException; import org.eclipse.jetty.http.AbstractGenerator; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -34,7 +34,7 @@ public class BlockingHttpConnection extends AbstractHttpConnection private static final Logger LOG = Log.getLogger(BlockingHttpConnection.class); private boolean _requestComplete; - private Buffer _requestContentChunk; + private ByteBuffer _requestContentChunk; BlockingHttpConnection(Buffers requestBuffers, Buffers responseBuffers, EndPoint endPoint) { @@ -114,7 +114,7 @@ public class BlockingHttpConnection extends AbstractHttpConnection else if (_generator.isEmpty()) { LOG.debug("addChunk"); - Buffer chunk=_requestContentChunk; + ByteBuffer chunk=_requestContentChunk; _requestContentChunk=exchange.getRequestContentChunk(null); _generator.addContent(chunk,_requestContentChunk==null); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/CachedExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/CachedExchange.java index 9885925c0b6..3ff28110fd6 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/CachedExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/CachedExchange.java @@ -15,7 +15,7 @@ package org.eclipse.jetty.client; import java.io.IOException; import org.eclipse.jetty.http.HttpFields; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; /** * An exchange that retains response status and response headers for later use. @@ -50,14 +50,14 @@ public class CachedExchange extends HttpExchange } @Override - protected synchronized void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected synchronized void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { _responseStatus = status; super.onResponseStatus(version, status, reason); } @Override - protected synchronized void onResponseHeader(Buffer name, Buffer value) throws IOException + protected synchronized void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { if (_responseFields != null) { diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/ContentExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/ContentExchange.java index 5673cef5841..88803a0f179 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/ContentExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/ContentExchange.java @@ -20,9 +20,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferUtil; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.io.ByteBuffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.StringUtil; /** @@ -60,7 +60,7 @@ public class ContentExchange extends CachedExchange } @Override - protected synchronized void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected synchronized void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if (_responseContent!=null) _responseContent.reset(); @@ -68,16 +68,16 @@ public class ContentExchange extends CachedExchange } @Override - protected synchronized void onResponseHeader(Buffer name, Buffer value) throws IOException + protected synchronized void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { super.onResponseHeader(name, value); - int header = HttpHeaders.CACHE.getOrdinal(name); + int header = HttpHeader.CACHE.getOrdinal(name); switch (header) { - case HttpHeaders.CONTENT_LENGTH_ORDINAL: + case HttpHeader.CONTENT_LENGTH_ORDINAL: _bufferSize = BufferUtil.toInt(value); break; - case HttpHeaders.CONTENT_TYPE_ORDINAL: + case HttpHeader.CONTENT_TYPE_ORDINAL: String mime = StringUtil.asciiToLowerCase(value.toString()); int i = mime.indexOf("charset="); if (i > 0) @@ -92,7 +92,7 @@ public class ContentExchange extends CachedExchange } @Override - protected synchronized void onResponseContent(Buffer content) throws IOException + protected synchronized void onResponseContent(ByteBuffer content) throws IOException { super.onResponseContent(content); if (_responseContent == null) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index 0b5581ed984..b43d835ba72 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -28,7 +28,7 @@ import org.eclipse.jetty.client.security.RealmResolver; import org.eclipse.jetty.client.security.SecurityListener; import org.eclipse.jetty.http.HttpBuffers; import org.eclipse.jetty.http.HttpBuffersImpl; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Buffers.Type; import org.eclipse.jetty.util.Attributes; @@ -154,7 +154,7 @@ public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attri /* ------------------------------------------------------------------------------- */ public void send(HttpExchange exchange) throws IOException { - boolean ssl = HttpSchemes.HTTPS_BUFFER.equalsIgnoreCase(exchange.getScheme()); + boolean ssl = HttpScheme.HTTPS_BUFFER.equalsIgnoreCase(exchange.getScheme()); exchange.setStatus(HttpExchange.STATUS_WAITING_FOR_CONNECTION); HttpDestination destination = getDestination(exchange.getAddress(), ssl); destination.send(exchange); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java index 18a197ced6a..a116e553506 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java @@ -27,11 +27,11 @@ import org.eclipse.jetty.client.HttpClient.Connector; import org.eclipse.jetty.client.security.Authentication; import org.eclipse.jetty.client.security.SecurityListener; import org.eclipse.jetty.http.HttpCookie; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.PathMap; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -94,7 +94,7 @@ public class HttpDestination implements Dumpable return _ssl; } - public Buffer getHostHeader() + public ByteBuffer getHostHeader() { return _hostHeader; } @@ -517,7 +517,7 @@ public class HttpDestination implements Dumpable buf.append(cookie.getValue()); // TODO quotes } if (buf != null) - ex.addRequestHeader(HttpHeaders.COOKIE, buf.toString()); + ex.addRequestHeader(HttpHeader.COOKIE, buf.toString()); } // Add any known authorizations @@ -674,13 +674,13 @@ public class HttpDestination implements Dumpable { this.proxyEndPoint = proxyEndPoint; this.exchange = exchange; - setMethod(HttpMethods.CONNECT); + setMethod(HttpMethod.CONNECT); setVersion(exchange.getVersion()); String serverHostAndPort = serverAddress.toString(); setRequestURI(serverHostAndPort); - addRequestHeader(HttpHeaders.HOST, serverHostAndPort); - addRequestHeader(HttpHeaders.PROXY_CONNECTION, "keep-alive"); - addRequestHeader(HttpHeaders.USER_AGENT, "Jetty-Client"); + addRequestHeader(HttpHeader.HOST, serverHostAndPort); + addRequestHeader(HttpHeader.PROXY_CONNECTION, "keep-alive"); + addRequestHeader(HttpHeader.USER_AGENT, "Jetty-Client"); } @Override diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListener.java index d4cef3d9ec7..169256d4f54 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListener.java @@ -16,7 +16,7 @@ package org.eclipse.jetty.client; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; /** * @@ -34,16 +34,16 @@ public interface HttpEventListener public void onRequestComplete() throws IOException; - public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException; + public void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException; - public void onResponseHeader(Buffer name, Buffer value) throws IOException; + public void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException; public void onResponseHeaderComplete() throws IOException; - public void onResponseContent(Buffer content) throws IOException; + public void onResponseContent(ByteBuffer content) throws IOException; public void onResponseComplete() throws IOException; diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java index e4bdd7e2600..c23fbb4e280 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java @@ -16,7 +16,7 @@ package org.eclipse.jetty.client; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; public class HttpEventListenerWrapper implements HttpEventListener { @@ -24,9 +24,9 @@ public class HttpEventListenerWrapper implements HttpEventListener boolean _delegatingRequests; boolean _delegatingResponses; boolean _delegationResult = true; - private Buffer _version; + private ByteBuffer _version; private int _status; - private Buffer _reason; + private ByteBuffer _reason; public HttpEventListenerWrapper() { @@ -119,13 +119,13 @@ public class HttpEventListenerWrapper implements HttpEventListener } } - public void onResponseContent(Buffer content) throws IOException + public void onResponseContent(ByteBuffer content) throws IOException { if (_delegatingResponses) _listener.onResponseContent(content); } - public void onResponseHeader(Buffer name, Buffer value) throws IOException + public void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { if (_delegatingResponses) _listener.onResponseHeader(name,value); @@ -137,7 +137,7 @@ public class HttpEventListenerWrapper implements HttpEventListener _listener.onResponseHeaderComplete(); } - public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + public void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if (_delegatingResponses) { diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java index 4332223f035..5bd2376a653 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java @@ -20,13 +20,13 @@ import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.jetty.client.security.SecurityListener; import org.eclipse.jetty.http.HttpFields; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpURI; -import org.eclipse.jetty.http.HttpVersions; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferCache.CachedBuffer; +import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.io.ByteBuffer; +import org.eclipse.jetty.io.BufferCache.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -44,7 +44,7 @@ import org.eclipse.jetty.util.thread.Timeout; *
  • The HTTP server address, see {@link #setAddress(Address)}, or {@link #setURI(URI)}, or {@link #setURL(String)}) *
  • The HTTP request method, URI and HTTP version (see {@link #setMethod(String)}, {@link #setRequestURI(String)}, and {@link #setVersion(int)}) *
  • The request headers (see {@link #addRequestHeader(String, String)} or {@link #setRequestHeader(String, String)}) - *
  • The request content (see {@link #setRequestContent(Buffer)} or {@link #setRequestContentSource(InputStream)}) + *
  • The request content (see {@link #setRequestContent(ByteBuffer)} or {@link #setRequestContentSource(InputStream)}) *
  • The status of the exchange (see {@link #getStatus()}) *
  • Callbacks to handle state changes (see the onXxx methods such as {@link #onRequestComplete()} or {@link #onResponseComplete()}) *
  • The ability to intercept callbacks (see {@link #setEventListener(HttpEventListener)} @@ -88,13 +88,13 @@ public class HttpExchange public static final int STATUS_CANCELLED = 11; // HTTP protocol fields - private String _method = HttpMethods.GET; - private Buffer _scheme = HttpSchemes.HTTP_BUFFER; + private String _method = HttpMethod.GET; + private ByteBuffer _scheme = HttpScheme.HTTP_BUFFER; private String _uri; - private int _version = HttpVersions.HTTP_1_1_ORDINAL; + private int _version = HttpVersion.HTTP_1_1_ORDINAL; private Address _address; private final HttpFields _requestFields = new HttpFields(); - private Buffer _requestContent; + private ByteBuffer _requestContent; private InputStream _requestContentSource; private AtomicInteger _status = new AtomicInteger(STATUS_START); @@ -459,7 +459,7 @@ public class HttpExchange * @param scheme * the scheme of the URL (for example 'http') */ - public void setScheme(Buffer scheme) + public void setScheme(ByteBuffer scheme) { _scheme = scheme; } @@ -472,10 +472,10 @@ public class HttpExchange { if (scheme != null) { - if (HttpSchemes.HTTP.equalsIgnoreCase(scheme)) - setScheme(HttpSchemes.HTTP_BUFFER); - else if (HttpSchemes.HTTPS.equalsIgnoreCase(scheme)) - setScheme(HttpSchemes.HTTPS_BUFFER); + if (HttpScheme.HTTP.equalsIgnoreCase(scheme)) + setScheme(HttpScheme.HTTP_BUFFER); + else if (HttpScheme.HTTPS.equalsIgnoreCase(scheme)) + setScheme(HttpScheme.HTTPS_BUFFER); else setScheme(new ByteArrayBuffer(scheme)); } @@ -484,7 +484,7 @@ public class HttpExchange /** * @return the scheme of the URL */ - public Buffer getScheme() + public ByteBuffer getScheme() { return _scheme; } @@ -504,7 +504,7 @@ public class HttpExchange */ public void setVersion(String version) { - CachedBuffer v = HttpVersions.CACHE.get(version); + CachedBuffer v = HttpVersion.CACHE.get(version); if (v == null) _version = 10; else @@ -642,7 +642,7 @@ public class HttpExchange * @param value * the header value */ - public void addRequestHeader(Buffer name, Buffer value) + public void addRequestHeader(ByteBuffer name, ByteBuffer value) { getRequestFields().add(name,value); } @@ -668,7 +668,7 @@ public class HttpExchange * @param value * the header value */ - public void setRequestHeader(Buffer name, Buffer value) + public void setRequestHeader(ByteBuffer name, ByteBuffer value) { getRequestFields().put(name,value); } @@ -679,7 +679,7 @@ public class HttpExchange */ public void setRequestContentType(String value) { - getRequestFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,value); + getRequestFields().put(HttpHeader.CONTENT_TYPE_BUFFER,value); } /** @@ -694,7 +694,7 @@ public class HttpExchange * @param requestContent * the request content */ - public void setRequestContent(Buffer requestContent) + public void setRequestContent(ByteBuffer requestContent) { _requestContent = requestContent; } @@ -718,7 +718,7 @@ public class HttpExchange return _requestContentSource; } - public Buffer getRequestContentChunk(Buffer buffer) throws IOException + public ByteBuffer getRequestContentChunk(ByteBuffer buffer) throws IOException { synchronized (this) { @@ -742,7 +742,7 @@ public class HttpExchange /** * @return the request content */ - public Buffer getRequestContent() + public ByteBuffer getRequestContent() { return _requestContent; } @@ -932,7 +932,7 @@ public class HttpExchange * @throws IOException * allowed to be thrown by overriding code */ - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { } @@ -946,7 +946,7 @@ public class HttpExchange * @throws IOException * allowed to be thrown by overriding code */ - protected void onResponseHeader(Buffer name, Buffer value) throws IOException + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { } @@ -968,7 +968,7 @@ public class HttpExchange * @throws IOException * allowed to be thrown by overriding code */ - protected void onResponseContent(Buffer content) throws IOException + protected void onResponseContent(ByteBuffer content) throws IOException { } @@ -1167,12 +1167,12 @@ public class HttpExchange } } - public void onResponseContent(Buffer content) throws IOException + public void onResponseContent(ByteBuffer content) throws IOException { HttpExchange.this.onResponseContent(content); } - public void onResponseHeader(Buffer name, Buffer value) throws IOException + public void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { HttpExchange.this.onResponseHeader(name,value); } @@ -1182,7 +1182,7 @@ public class HttpExchange HttpExchange.this.onResponseHeaderComplete(); } - public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + public void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { HttpExchange.this.onResponseStatus(version,status,reason); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java index 00bc4595432..39d0194044c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java @@ -15,10 +15,10 @@ package org.eclipse.jetty.client; import java.io.IOException; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; /** * RedirectListener @@ -46,7 +46,7 @@ public class RedirectListener extends HttpEventListenerWrapper } @Override - public void onResponseStatus( Buffer version, int status, Buffer reason ) + public void onResponseStatus( ByteBuffer version, int status, ByteBuffer reason ) throws IOException { _redirected = ((status == HttpStatus.MOVED_PERMANENTLY_301 || @@ -64,15 +64,15 @@ public class RedirectListener extends HttpEventListenerWrapper @Override - public void onResponseHeader( Buffer name, Buffer value ) + public void onResponseHeader( ByteBuffer name, ByteBuffer value ) throws IOException { if (_redirected) { - int header = HttpHeaders.CACHE.getOrdinal(name); + int header = HttpHeader.CACHE.getOrdinal(name); switch (header) { - case HttpHeaders.LOCATION_ORDINAL: + case HttpHeader.LOCATION_ORDINAL: _location = value.toString(); break; } @@ -119,7 +119,7 @@ public class RedirectListener extends HttpEventListenerWrapper } // destination may have changed - boolean isHttps = HttpSchemes.HTTPS.equals(String.valueOf(_exchange.getScheme())); + boolean isHttps = HttpScheme.HTTPS.equals(String.valueOf(_exchange.getScheme())); HttpDestination destination=_destination.getHttpClient().getDestination(_exchange.getAddress(),isHttps); if (_destination==destination) @@ -151,7 +151,7 @@ public class RedirectListener extends HttpEventListenerWrapper hostHeader.append( port ); } - _exchange.setRequestHeader( HttpHeaders.HOST, hostHeader.toString() ); + _exchange.setRequestHeader( HttpHeader.HOST, hostHeader.toString() ); destination.send(_exchange); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java index e1c282e74db..a842a1c69b9 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java @@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap; import javax.net.ssl.SSLEngine; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ConnectedEndPoint; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.nio.AsyncConnection; @@ -306,7 +306,7 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector _endp.close(); } - public int fill(Buffer buffer) throws IOException + public int fill(ByteBuffer buffer) throws IOException { return _endp.fill(buffer); } @@ -321,7 +321,7 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector return _endp.hasProgressed(); } - public int flush(Buffer buffer) throws IOException + public int flush(ByteBuffer buffer) throws IOException { return _endp.flush(buffer); } @@ -336,7 +336,7 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector _endp.cancelTimeout(task); } - public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException + public int flush(ByteBuffer header, ByteBuffer buffer, ByteBuffer trailer) throws IOException { return _endp.flush(header,buffer,trailer); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/security/BasicAuthentication.java b/jetty-client/src/main/java/org/eclipse/jetty/client/security/BasicAuthentication.java index f6305c67d17..d38f380acb1 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/security/BasicAuthentication.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/security/BasicAuthentication.java @@ -17,8 +17,8 @@ package org.eclipse.jetty.client.security; import java.io.IOException; import org.eclipse.jetty.client.HttpExchange; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.StringUtil; @@ -30,7 +30,7 @@ import org.eclipse.jetty.util.StringUtil; */ public class BasicAuthentication implements Authentication { - private Buffer _authorization; + private ByteBuffer _authorization; public BasicAuthentication(Realm realm) throws IOException { @@ -47,6 +47,6 @@ public class BasicAuthentication implements Authentication */ public void setCredentials( HttpExchange exchange ) throws IOException { - exchange.setRequestHeader( HttpHeaders.AUTHORIZATION_BUFFER, _authorization); + exchange.setRequestHeader( HttpHeader.AUTHORIZATION_BUFFER, _authorization); } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/security/DigestAuthentication.java b/jetty-client/src/main/java/org/eclipse/jetty/client/security/DigestAuthentication.java index 032a2aafab2..0a60a3b80cd 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/security/DigestAuthentication.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/security/DigestAuthentication.java @@ -19,7 +19,7 @@ import java.security.MessageDigest; import java.util.Map; import org.eclipse.jetty.client.HttpExchange; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; @@ -63,7 +63,7 @@ public class DigestAuthentication implements Authentication buffer.append(", ").append("cnonce").append('=').append('"').append(cnonce).append('"'); - exchange.setRequestHeader( HttpHeaders.AUTHORIZATION, + exchange.setRequestHeader( HttpHeader.AUTHORIZATION, new String(buffer.toString().getBytes(StringUtil.__ISO_8859_1))); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/security/ProxyAuthorization.java b/jetty-client/src/main/java/org/eclipse/jetty/client/security/ProxyAuthorization.java index f6b0841130b..756d08e1209 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/security/ProxyAuthorization.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/security/ProxyAuthorization.java @@ -17,8 +17,8 @@ package org.eclipse.jetty.client.security; import java.io.IOException; import org.eclipse.jetty.client.HttpExchange; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.StringUtil; @@ -30,7 +30,7 @@ import org.eclipse.jetty.util.StringUtil; */ public class ProxyAuthorization implements Authentication { - private Buffer _authorization; + private ByteBuffer _authorization; public ProxyAuthorization(String username,String password) throws IOException { @@ -47,6 +47,6 @@ public class ProxyAuthorization implements Authentication */ public void setCredentials( HttpExchange exchange ) throws IOException { - exchange.setRequestHeader( HttpHeaders.PROXY_AUTHORIZATION_BUFFER, _authorization); + exchange.setRequestHeader( HttpHeader.PROXY_AUTHORIZATION_BUFFER, _authorization); } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/security/SecurityListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/security/SecurityListener.java index 5dea0ada8f5..828bd2fdfb0 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/security/SecurityListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/security/SecurityListener.java @@ -21,9 +21,9 @@ import java.util.StringTokenizer; import org.eclipse.jetty.client.HttpDestination; import org.eclipse.jetty.client.HttpEventListenerWrapper; import org.eclipse.jetty.client.HttpExchange; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -116,7 +116,7 @@ public class SecurityListener extends HttpEventListenerWrapper @Override - public void onResponseStatus( Buffer version, int status, Buffer reason ) + public void onResponseStatus( ByteBuffer version, int status, ByteBuffer reason ) throws IOException { if (LOG.isDebugEnabled()) @@ -139,7 +139,7 @@ public class SecurityListener extends HttpEventListenerWrapper @Override - public void onResponseHeader( Buffer name, Buffer value ) + public void onResponseHeader( ByteBuffer name, ByteBuffer value ) throws IOException { if (LOG.isDebugEnabled()) @@ -148,10 +148,10 @@ public class SecurityListener extends HttpEventListenerWrapper if (!isDelegatingResponses()) { - int header = HttpHeaders.CACHE.getOrdinal(name); + int header = HttpHeader.CACHE.getOrdinal(name); switch (header) { - case HttpHeaders.WWW_AUTHENTICATE_ORDINAL: + case HttpHeader.WWW_AUTHENTICATE_ORDINAL: // TODO don't hard code this bit. String authString = value.toString(); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/MkcolExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/MkcolExchange.java index f85fc48cca6..dc0dc5e94a7 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/MkcolExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/MkcolExchange.java @@ -17,7 +17,7 @@ import java.io.IOException; import org.eclipse.jetty.client.CachedExchange; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -35,7 +35,7 @@ public class MkcolExchange extends CachedExchange /* ------------------------------------------------------------ */ @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if ( status == HttpStatus.CREATED_201 ) { diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/PropfindExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/PropfindExchange.java index c8b10606437..09224c54eef 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/PropfindExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/PropfindExchange.java @@ -17,7 +17,7 @@ import java.io.IOException; import org.eclipse.jetty.client.HttpExchange; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -30,7 +30,7 @@ public class PropfindExchange extends HttpExchange /* ------------------------------------------------------------ */ @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if ( status == HttpStatus.OK_200 ) { diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java index 614b031e77e..502dd8fa7a3 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java @@ -20,9 +20,9 @@ import org.eclipse.jetty.client.HttpDestination; import org.eclipse.jetty.client.HttpEventListenerWrapper; import org.eclipse.jetty.client.HttpExchange; import org.eclipse.jetty.client.security.SecurityListener; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -54,14 +54,14 @@ public class WebdavListener extends HttpEventListenerWrapper _exchange=ex; // We'll only enable webdav if this is a PUT request - if ( HttpMethods.PUT.equalsIgnoreCase( _exchange.getMethod() ) ) + if ( HttpMethod.PUT.equalsIgnoreCase( _exchange.getMethod() ) ) { _webdavEnabled = true; } } @Override - public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + public void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if ( !_webdavEnabled ) { @@ -252,7 +252,7 @@ public class WebdavListener extends HttpEventListenerWrapper PropfindExchange propfindExchange = new PropfindExchange(); propfindExchange.setAddress( _exchange.getAddress() ); - propfindExchange.setMethod( HttpMethods.GET ); // PROPFIND acts wonky, just use get + propfindExchange.setMethod( HttpMethod.GET ); // PROPFIND acts wonky, just use get propfindExchange.setScheme( _exchange.getScheme() ); propfindExchange.setEventListener( new SecurityListener( _destination, propfindExchange ) ); propfindExchange.setConfigureListeners( false ); @@ -303,7 +303,7 @@ public class WebdavListener extends HttpEventListenerWrapper { WebdavSupportedExchange supportedExchange = new WebdavSupportedExchange(); supportedExchange.setAddress( _exchange.getAddress() ); - supportedExchange.setMethod( HttpMethods.OPTIONS ); + supportedExchange.setMethod( HttpMethod.OPTIONS ); supportedExchange.setScheme( _exchange.getScheme() ); supportedExchange.setEventListener( new SecurityListener( _destination, supportedExchange ) ); supportedExchange.setConfigureListeners( false ); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavSupportedExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavSupportedExchange.java index 41716ef9786..1a439a6a31e 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavSupportedExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavSupportedExchange.java @@ -16,7 +16,7 @@ package org.eclipse.jetty.client.webdav; import java.io.IOException; import org.eclipse.jetty.client.HttpExchange; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -29,7 +29,7 @@ public class WebdavSupportedExchange extends HttpExchange private boolean _isComplete = false; @Override - protected void onResponseHeader(Buffer name, Buffer value) throws IOException + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { if (LOG.isDebugEnabled()) LOG.debug("WebdavSupportedExchange:Header:" + name.toString() + " / " + value.toString() ); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java index c65525583d8..8281ec30d72 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java @@ -21,7 +21,7 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.server.AbstractHttpConnection; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; @@ -198,7 +198,7 @@ public abstract class AbstractHttpExchangeCancelTest TestHttpExchange exchange = new TestHttpExchange() { @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { super.onResponseStatus(version, status, reason); cancel(); @@ -223,7 +223,7 @@ public abstract class AbstractHttpExchangeCancelTest TestHttpExchange exchange = new TestHttpExchange() { @Override - protected void onResponseHeader(Buffer name, Buffer value) throws IOException + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { super.onResponseHeader(name, value); cancel(); @@ -273,7 +273,7 @@ public abstract class AbstractHttpExchangeCancelTest TestHttpExchange exchange = new TestHttpExchange() { @Override - protected void onResponseContent(Buffer content) throws IOException + protected void onResponseContent(ByteBuffer content) throws IOException { super.onResponseContent(content); cancel(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ContentExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ContentExchangeTest.java index e004d71bb03..caa0fde1a11 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ContentExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ContentExchangeTest.java @@ -32,7 +32,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.security.Realm; import org.eclipse.jetty.client.security.SimpleRealmResolver; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.EofException; @@ -116,7 +116,7 @@ public class ContentExchangeTest ContentExchange putExchange = new ContentExchange(); putExchange.setURL(getBaseUrl() + "output.txt"); - putExchange.setMethod(HttpMethods.PUT); + putExchange.setMethod(HttpMethod.PUT); putExchange.setRequestContent(new ByteArrayBuffer(_content.getBytes())); _client.send(putExchange); @@ -141,7 +141,7 @@ public class ContentExchangeTest ContentExchange getExchange = new ContentExchange(); getExchange.setURL(getBaseUrl() + "input.txt"); - getExchange.setMethod(HttpMethods.GET); + getExchange.setMethod(HttpMethod.GET); _client.send(getExchange); int state = getExchange.waitForDone(); @@ -167,7 +167,7 @@ public class ContentExchangeTest ContentExchange getExchange = new ContentExchange(); getExchange.setURL(getBaseUrl() + "input.txt"); - getExchange.setMethod(HttpMethods.HEAD); + getExchange.setMethod(HttpMethod.HEAD); _client.send(getExchange); getExchange.waitForDone(); @@ -187,7 +187,7 @@ public class ContentExchangeTest ContentExchange postExchange = new ContentExchange(); postExchange.setURL(getBaseUrl() + "test"); - postExchange.setMethod(HttpMethods.POST); + postExchange.setMethod(HttpMethod.POST); postExchange.setRequestContent(new ByteArrayBuffer(_content.getBytes())); _client.send(postExchange); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/Curl.java b/jetty-client/src/test/java/org/eclipse/jetty/client/Curl.java index 6c4d5102709..40ff148f2c0 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/Curl.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/Curl.java @@ -4,8 +4,8 @@ import java.io.IOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; -import org.eclipse.jetty.http.HttpMethods; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.io.ByteBuffer; /* ------------------------------------------------------------ */ @@ -116,7 +116,7 @@ public class Curl } @Override - protected void onResponseContent(Buffer content) throws IOException + protected void onResponseContent(ByteBuffer content) throws IOException { super.onResponseContent(content); if (d) @@ -127,10 +127,10 @@ public class Curl /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.client.HttpExchange#onResponseHeader(org.eclipse.jetty.io.Buffer, org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.client.HttpExchange#onResponseHeader(org.eclipse.jetty.io.ByteBuffer, org.eclipse.jetty.io.ByteBuffer) */ @Override - protected void onResponseHeader(Buffer name, Buffer value) throws IOException + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { super.onResponseHeader(name,value); if (v) @@ -151,10 +151,10 @@ public class Curl /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.client.HttpExchange#onResponseStatus(org.eclipse.jetty.io.Buffer, int, org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.client.HttpExchange#onResponseStatus(org.eclipse.jetty.io.ByteBuffer, int, org.eclipse.jetty.io.ByteBuffer) */ @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { super.onResponseStatus(version,status,reason); if (v) @@ -162,7 +162,7 @@ public class Curl } }; - ex.setMethod(HttpMethods.GET); + ex.setMethod(HttpMethod.GET); ex.setURL(arg); System.err.println("\nSending "+ex); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ErrorStatusTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ErrorStatusTest.java index 46097f2336b..d8992d14c2a 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ErrorStatusTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ErrorStatusTest.java @@ -21,7 +21,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.server.Handler; @@ -160,7 +160,7 @@ public class ErrorStatusTest ContentExchange putExchange = new ContentExchange(); putExchange.setURL(getBaseUrl() + "output.txt"); - putExchange.setMethod(HttpMethods.PUT); + putExchange.setMethod(HttpMethod.PUT); putExchange.setRequestHeader("X-Response-Status",Integer.toString(status)); putExchange.setRequestContent(new ByteArrayBuffer(getContent().getBytes())); @@ -182,7 +182,7 @@ public class ErrorStatusTest ContentExchange getExchange = new ContentExchange(); getExchange.setURL(getBaseUrl() + "input.txt"); - getExchange.setMethod(HttpMethods.GET); + getExchange.setMethod(HttpMethod.GET); getExchange.setRequestHeader("X-Response-Status",Integer.toString(status)); getClient().send(getExchange); @@ -207,7 +207,7 @@ public class ErrorStatusTest ContentExchange postExchange = new ContentExchange(); postExchange.setURL(getBaseUrl() + "test"); - postExchange.setMethod(HttpMethods.POST); + postExchange.setMethod(HttpMethod.POST); postExchange.setRequestHeader("X-Response-Status",Integer.toString(status)); postExchange.setRequestContent(new ByteArrayBuffer(getContent().getBytes())); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/Http100ContinueTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/Http100ContinueTest.java index b764de3c788..9dca33f7c72 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/Http100ContinueTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/Http100ContinueTest.java @@ -26,7 +26,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; @@ -186,7 +186,7 @@ public class Http100ContinueTest public void configureExchange(ContentExchange exchange) { exchange.setURL(_requestUrl); - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); exchange.addRequestHeader("User-Agent","Jetty-Client/7.0"); exchange.addRequestHeader("Expect","100-continue"); //server to send CONTINUE 100 } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java index d4fbf0fdd4b..a2254846bb2 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java @@ -33,9 +33,9 @@ import org.eclipse.jetty.client.helperClasses.HttpServerAndClientCreator; import org.eclipse.jetty.client.helperClasses.ServerAndClientCreator; import org.eclipse.jetty.client.security.ProxyAuthorization; import org.eclipse.jetty.http.HttpFields; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EofException; @@ -162,7 +162,7 @@ public class HttpExchangeTest @Override /* ------------------------------------------------------------ */ - protected void onResponseStatus(Buffer version, int status, Buffer reason) + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) { if (verbose) System.err.println(n+" ] "+version+" "+status+" "+reason); @@ -171,7 +171,7 @@ public class HttpExchangeTest /* ------------------------------------------------------------ */ @Override - protected void onResponseHeader(Buffer name, Buffer value) + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) { if (verbose) System.err.println(n+" ] "+name+": "+value); @@ -189,7 +189,7 @@ public class HttpExchangeTest /* ------------------------------------------------------------ */ @Override - protected void onResponseContent(Buffer content) + protected void onResponseContent(ByteBuffer content) { len += content.length(); if (verbose) @@ -278,7 +278,7 @@ public class HttpExchangeTest { ContentExchange httpExchange=new ContentExchange(); httpExchange.setURI(getBaseURI()); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("")); _httpClient.send(httpExchange); int status = httpExchange.waitForDone(); @@ -298,7 +298,7 @@ public class HttpExchangeTest ContentExchange httpExchange=new ContentExchange(); URI uri = getBaseURI().resolve("?i=" + i); httpExchange.setURI(uri); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); _httpClient.send(httpExchange); int status = httpExchange.waitForDone(); //httpExchange.waitForStatus(HttpExchange.STATUS_COMPLETED); @@ -320,7 +320,7 @@ public class HttpExchangeTest ContentExchange httpExchange=new ContentExchange(); URI uri = getBaseURI().resolve("?i=" + i); httpExchange.setURI(uri); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); _httpClient.send(httpExchange); int status = httpExchange.waitForDone(); @@ -396,7 +396,7 @@ public class HttpExchangeTest int total; @Override - protected synchronized void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected synchronized void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if (verbose) System.err.println("] "+version+" "+status+" "+reason); @@ -404,7 +404,7 @@ public class HttpExchangeTest } @Override - protected synchronized void onResponseHeader(Buffer name, Buffer value) throws IOException + protected synchronized void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { if (verbose) System.err.println("] "+name+": "+value); @@ -412,7 +412,7 @@ public class HttpExchangeTest } @Override - protected synchronized void onResponseContent(Buffer content) throws IOException + protected synchronized void onResponseContent(ByteBuffer content) throws IOException { if (verbose) { @@ -440,8 +440,8 @@ public class HttpExchangeTest }; - Buffer babuf = new ByteArrayBuffer(size*36*1024); - Buffer niobuf = new DirectNIOBuffer(size*36*1024); + ByteBuffer babuf = new ByteArrayBuffer(size*36*1024); + ByteBuffer niobuf = new DirectNIOBuffer(size*36*1024); byte[] bytes="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".getBytes(); @@ -452,7 +452,7 @@ public class HttpExchangeTest } httpExchange.setURI(getBaseURI()); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContentType("application/data"); httpExchange.setRequestContent(babuf); _httpClient.send(httpExchange); @@ -479,7 +479,7 @@ public class HttpExchangeTest httpExchange.reset(); httpExchange.setURI(getBaseURI()); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContentType("application/data"); httpExchange.setRequestContent(niobuf); _httpClient.send(httpExchange); @@ -511,7 +511,7 @@ public class HttpExchangeTest { ContentExchange httpExchange=new ContentExchange(); httpExchange.setURI(getBaseURI()); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); final String data="012345678901234567890123456789012345678901234567890123456789"; @@ -588,7 +588,7 @@ public class HttpExchangeTest ContentExchange httpExchange=new ContentExchange(); httpExchange.setAddress(new Address("jetty.eclipse.org",8080)); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); httpExchange.setRequestURI("/jetty-6"); _httpClient.send(httpExchange); int status = httpExchange.waitForDone(); @@ -620,7 +620,7 @@ public class HttpExchangeTest assertNotNull(connections[i]); HttpExchange ex = new ContentExchange(); ex.setURI(getBaseURI().resolve("?i=" + i)); - ex.setMethod(HttpMethods.GET); + ex.setMethod(HttpMethod.GET); connections[i].send(ex); } @@ -648,7 +648,7 @@ public class HttpExchangeTest ContentExchange httpExchange = new ContentExchange(true); httpExchange.setURL(getBaseURI().toASCIIString()); httpExchange.setRequestURI("*"); - httpExchange.setMethod(HttpMethods.OPTIONS); + httpExchange.setMethod(HttpMethod.OPTIONS); // httpExchange.setRequestHeader("Connection","close"); _httpClient.send(httpExchange); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java index 4341c86aa84..2d3f3bf75c6 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.security.Realm; import org.eclipse.jetty.client.security.SimpleRealmResolver; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -103,7 +103,7 @@ public class HttpGetRedirectTest ContentExchange getExchange = new ContentExchange(); getExchange.setURL(_requestUrl); - getExchange.setMethod(HttpMethods.GET); + getExchange.setMethod(HttpMethod.GET); _client.send(getExchange); int state = getExchange.waitForDone(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpHeadersTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpHeadersTest.java index 197b6eb5c38..c8a76844f6f 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpHeadersTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpHeadersTest.java @@ -26,7 +26,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; @@ -99,7 +99,7 @@ public class HttpHeadersTest ContentExchange exchange = new ContentExchange(); exchange.setURL(requestUrl); - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); exchange.addRequestHeader("User-Agent","Jetty-Client/7.0"); httpClient.send(exchange); @@ -140,7 +140,7 @@ public class HttpHeadersTest } }; exchange.setURL(requestUrl); - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); for (int i = 0; i < 4; i++) { diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java index 89a55f510e0..da37b71b812 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ProxyTunnellingTest.java @@ -13,8 +13,8 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.server.Connector; @@ -108,7 +108,7 @@ public class ProxyTunnellingTest try { ContentExchange exchange = new ContentExchange(true); - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); String body = "BODY"; exchange.setURL("https://localhost:" + serverConnector.getLocalPort() + "/echo?body=" + URLEncoder.encode(body, "UTF-8")); @@ -136,7 +136,7 @@ public class ProxyTunnellingTest try { ContentExchange exchange = new ContentExchange(true); - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); String body = "BODY"; exchange.setURL("https://localhost:" + serverConnector.getLocalPort() + "/echo?body=" + URLEncoder.encode(body, "UTF-8")); @@ -146,11 +146,11 @@ public class ProxyTunnellingTest assertEquals(body, content); exchange = new ContentExchange(true); - exchange.setMethod(HttpMethods.POST); + exchange.setMethod(HttpMethod.POST); exchange.setURL("https://localhost:" + serverConnector.getLocalPort() + "/echo"); - exchange.setRequestHeader(HttpHeaders.CONTENT_TYPE, MimeTypes.FORM_ENCODED); + exchange.setRequestHeader(HttpHeader.CONTENT_TYPE, MimeTypes.FORM_ENCODED); content = "body=" + body; - exchange.setRequestHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(content.length())); + exchange.setRequestHeader(HttpHeader.CONTENT_LENGTH, String.valueOf(content.length())); exchange.setRequestContent(new ByteArrayBuffer(content, "UTF-8")); httpClient.send(exchange); @@ -187,7 +187,7 @@ public class ProxyTunnellingTest latch.countDown(); } }; - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); String body = "BODY"; exchange.setURL("https://localhost:" + serverConnector.getLocalPort() + "/echo?body=" + URLEncoder.encode(body, "UTF-8")); @@ -224,7 +224,7 @@ public class ProxyTunnellingTest } }; - exchange.setMethod(HttpMethods.GET); + exchange.setMethod(HttpMethod.GET); String body = "BODY"; exchange.setURL("https://localhost:" + serverPort + "/echo?body=" + URLEncoder.encode(body, "UTF-8")); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SecurityListenerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SecurityListenerTest.java index 8a1e8a50e94..90e3ae6c064 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SecurityListenerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SecurityListenerTest.java @@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.security.Realm; import org.eclipse.jetty.client.security.SimpleRealmResolver; -import org.eclipse.jetty.http.HttpMethods; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; @@ -139,19 +139,19 @@ public class SecurityListenerTest } @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) { // System.err.println("Response Status: " + version+" "+status+" "+reason); } @Override - protected void onResponseHeader(Buffer name, Buffer value) + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) { // System.err.println("Response header: " + name + " = " + value); } @Override - protected void onResponseContent(Buffer content) + protected void onResponseContent(ByteBuffer content) { // System.err.println("Response content:" + content); } @@ -227,7 +227,7 @@ public class SecurityListenerTest }; httpExchange.setURL("http://localhost:" + _port + "/?i=1"); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); _httpClient.send(httpExchange); @@ -246,7 +246,7 @@ public class SecurityListenerTest }; httpExchange2.setURL("http://localhost:" + _port + "/?i=2"); - httpExchange2.setMethod(HttpMethods.GET); + httpExchange2.setMethod(HttpMethod.GET); _httpClient.send(httpExchange2); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java b/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java index bc476c27fc7..3c41db4f1a2 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/Siege.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; -import org.eclipse.jetty.http.HttpMethods; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.thread.QueuedThreadPool; @@ -79,7 +79,7 @@ public class Siege /* ------------------------------------------------------------ */ @Override - protected void onResponseContent(Buffer content) throws IOException + protected void onResponseContent(ByteBuffer content) throws IOException { _bytes+=content.length(); super.onResponseContent(content); @@ -87,10 +87,10 @@ public class Siege /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.client.HttpExchange#onResponseHeader(org.eclipse.jetty.io.Buffer, org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.client.HttpExchange#onResponseHeader(org.eclipse.jetty.io.ByteBuffer, org.eclipse.jetty.io.ByteBuffer) */ @Override - protected void onResponseHeader(Buffer name, Buffer value) throws IOException + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { super.onResponseHeader(name,value); if ("Set-Cookie".equalsIgnoreCase(name.toString())) @@ -115,10 +115,10 @@ public class Siege /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.client.HttpExchange#onResponseStatus(org.eclipse.jetty.io.Buffer, int, org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.client.HttpExchange#onResponseStatus(org.eclipse.jetty.io.ByteBuffer, int, org.eclipse.jetty.io.ByteBuffer) */ @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { _status=status; super.onResponseStatus(version,status,reason); @@ -137,7 +137,7 @@ public class Siege String uri=_uris.get(_u++); reset(); - setMethod(HttpMethods.GET); + setMethod(HttpMethod.GET); setURL(uri); try diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SluggishServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SluggishServerTest.java index 65252038b7c..d26db3eac7a 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SluggishServerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SluggishServerTest.java @@ -11,9 +11,9 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.Assert; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.bio.SocketConnector; @@ -74,7 +74,7 @@ public class SluggishServerTest setURL(URL+port); setRequestContentSource(new SluggishStream(request)); setRequestContentType("application/octet-stream"); - setRequestHeader(HttpHeaders.TRANSFER_ENCODING,HttpHeaderValues.CHUNKED); + setRequestHeader(HttpHeader.TRANSFER_ENCODING,HttpHeaderValue.CHUNKED); } public byte[] getRequestBody() @@ -95,14 +95,14 @@ public class SluggishServerTest } @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { //System.err.printf("<<< %s %d %s%n",version,status,reason); super.onResponseStatus(version,status,reason); } @Override - protected void onResponseHeader(Buffer name, Buffer value) throws IOException + protected void onResponseHeader(ByteBuffer name, ByteBuffer value) throws IOException { //System.err.printf("<<< %s: %s%n",name,value); super.onResponseHeader(name,value); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesClientTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesClientTest.java index a2f041b7d0e..8c56264b537 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesClientTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesClientTest.java @@ -14,7 +14,7 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLSocket; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.ssl.SslContextFactory; @@ -73,7 +73,7 @@ public class SslBytesClientTest extends SslBytesTest { ContentExchange exchange = new ContentExchange(true); exchange.setURL("https://localhost:" + proxy.getPort()); - String method = HttpMethods.GET; + String method = HttpMethod.GET; exchange.setMethod(method); client.send(exchange); Assert.assertTrue(proxy.awaitClient(5, TimeUnit.SECONDS)); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java index be41f47bb96..c1886300327 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslBytesServerTest.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpParser; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -95,7 +95,7 @@ public class SslBytesServerTest extends SslBytesTest return new SslEndPoint() { @Override - public int flush(Buffer buffer) throws IOException + public int flush(ByteBuffer buffer) throws IOException { sslFlushes.incrementAndGet(); return super.flush(buffer); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java index 1e9c18ead65..1e713ee2f1c 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/SslSecurityListenerTest.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.security.HashRealmResolver; import org.eclipse.jetty.client.security.Realm; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.security.ConstraintMapping; import org.eclipse.jetty.security.ConstraintSecurityHandler; @@ -142,7 +142,7 @@ public class SslSecurityListenerTest }; httpExchange.setURL("https://127.0.0.1:" + _port + "/"); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); _httpClient.send(httpExchange); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java index 8d8ecb18b03..f286b31c77b 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java @@ -23,7 +23,7 @@ import javax.servlet.http.HttpServletResponse; import junit.framework.Assert; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.server.Connector; @@ -117,7 +117,7 @@ public class TimeoutExchangeTest CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("

    ??

    ")); _httpClient.send(httpExchange); @@ -135,7 +135,7 @@ public class TimeoutExchangeTest CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("

    ??

    ")); _httpClient.send(httpExchange); @@ -154,7 +154,7 @@ public class TimeoutExchangeTest CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("

    ??

    ")); httpExchange.setTimeout(exchangeTimeout); _httpClient.send(httpExchange); @@ -175,7 +175,7 @@ public class TimeoutExchangeTest CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("

    ??

    ")); httpExchange.setTimeout(exchangeTimeout); _httpClient.send(httpExchange); @@ -197,7 +197,7 @@ public class TimeoutExchangeTest CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("

    ??

    ")); _httpClient.send(httpExchange); @@ -219,7 +219,7 @@ public class TimeoutExchangeTest CustomContentExchange httpExchange = new CustomContentExchange(); httpExchange.setURL("http://localhost:" + _port + "/?sleep=" + serverSleep); - httpExchange.setMethod(HttpMethods.POST); + httpExchange.setMethod(HttpMethod.POST); httpExchange.setRequestContent(new ByteArrayBuffer("

    ??

    ")); httpExchange.setTimeout(exchangeTimeout); _httpClient.send(httpExchange); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/UnexpectedDataTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/UnexpectedDataTest.java index 74dd69d43d4..6d07943ed70 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/UnexpectedDataTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/UnexpectedDataTest.java @@ -25,7 +25,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -84,7 +84,7 @@ public class UnexpectedDataTest } }; httpExchange.setURL("http://localhost:" + _port + "/?i=" + i); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); _httpClient.send(httpExchange); Assert.assertTrue(done.await(1000, TimeUnit.SECONDS)); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java index d282544e8e7..bf17d0e24ff 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/WebSocketUpgradeTest.java @@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; -import org.eclipse.jetty.http.HttpMethods; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.server.Connector; @@ -110,10 +110,10 @@ public class WebSocketUpgradeTest { /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.client.HttpExchange#onResponseStatus(org.eclipse.jetty.io.Buffer, int, org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.client.HttpExchange#onResponseStatus(org.eclipse.jetty.io.ByteBuffer, int, org.eclipse.jetty.io.ByteBuffer) */ @Override - protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException + protected void onResponseStatus(ByteBuffer version, int status, ByteBuffer reason) throws IOException { waitFor(2); _results.add(new Integer(status)); @@ -153,7 +153,7 @@ public class WebSocketUpgradeTest }; httpExchange.setURL("http://localhost:"+_port+"/"); - httpExchange.setMethod(HttpMethods.GET); + httpExchange.setMethod(HttpMethod.GET); httpExchange.addRequestHeader("Upgrade","WebSocket"); httpExchange.addRequestHeader("Connection","Upgrade"); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/WebdavListenerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/WebdavListenerTest.java index a673843fac7..78a9ac4d718 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/WebdavListenerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/WebdavListenerTest.java @@ -17,7 +17,7 @@ import java.io.File; import org.eclipse.jetty.client.security.Realm; import org.eclipse.jetty.client.security.SimpleRealmResolver; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; @@ -99,7 +99,7 @@ public class WebdavListenerTest //PUT a FILE ContentExchange singleFileExchange = new ContentExchange(); singleFileExchange.setURL(_singleFileURL); - singleFileExchange.setMethod( HttpMethods.PUT ); + singleFileExchange.setMethod( HttpMethod.PUT ); singleFileExchange.setFileForUpload(file); singleFileExchange.setRequestHeader( "Content-Type", "application/octet-stream"); singleFileExchange.setRequestHeader("Content-Length", String.valueOf( file.length() )); @@ -112,7 +112,7 @@ public class WebdavListenerTest //PUT a FILE in a directory hierarchy ContentExchange dirFileExchange = new ContentExchange(); dirFileExchange.setURL(_dirFileURL); - dirFileExchange.setMethod( HttpMethods.PUT ); + dirFileExchange.setMethod( HttpMethod.PUT ); dirFileExchange.setFileForUpload(file); dirFileExchange.setRequestHeader( "Content-Type", "application/octet-stream"); dirFileExchange.setRequestHeader("Content-Length", String.valueOf( file.length() )); @@ -125,13 +125,13 @@ public class WebdavListenerTest //DELETE the single file HttpExchange del = new HttpExchange(); del.setURL(_singleFileURL); - del.setMethod(HttpMethods.DELETE); + del.setMethod(HttpMethod.DELETE); _httpClient.send(del); del.waitForDone(); //DELETE the whole dir del.setURL(_dirURL); - del.setMethod(HttpMethods.DELETE); + del.setMethod(HttpMethod.DELETE); del.setRequestHeader("Depth", "infinity"); _httpClient.send(del); del.waitForDone(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/helperClasses/GenericServerHandler.java b/jetty-client/src/test/java/org/eclipse/jetty/client/helperClasses/GenericServerHandler.java index cc9ac055454..cd318839990 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/helperClasses/GenericServerHandler.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/helperClasses/GenericServerHandler.java @@ -7,7 +7,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; @@ -33,7 +33,7 @@ public class GenericServerHandler extends AbstractHandler if (request.getServerName().equals("jetty.eclipse.org")) { response.getOutputStream().println("Proxy request: " + request.getRequestURL()); - response.getOutputStream().println(request.getHeader(HttpHeaders.PROXY_AUTHORIZATION)); + response.getOutputStream().println(request.getHeader(HttpHeader.PROXY_AUTHORIZATION)); } else if (request.getMethod().equalsIgnoreCase("GET")) { diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java index 89c3db10264..9ddb356eb76 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/AbstractGenerator.java @@ -14,6 +14,9 @@ package org.eclipse.jetty.http; import java.io.IOException; +import java.nio.ByteBuffer; + +import javax.swing.text.View; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.EndPoint; @@ -50,9 +53,9 @@ public abstract class AbstractGenerator implements Generator protected int _state = STATE_HEADER; protected int _status = 0; - protected int _version = HttpVersions.HTTP_1_1_ORDINAL; - protected Buffer _reason; - protected Buffer _method; + protected HttpVersion _version = HttpVersion.HTTP_1_1; + protected ByteBuffer _reason; + protected ByteBuffer _method; protected String _uri; protected long _contentWritten = 0; @@ -62,11 +65,11 @@ public abstract class AbstractGenerator implements Generator protected boolean _noContent = false; protected Boolean _persistent = null; - protected Buffer _header; // Buffer for HTTP header (and maybe small _content) - protected Buffer _buffer; // Buffer for copy of passed _content - protected Buffer _content; // Buffer passed to addContent + protected ByteBuffer _header; // Buffer for HTTP header (and maybe small _content) + protected ByteBuffer _buffer; // Buffer for copy of passed _content + protected ByteBuffer _content; // Buffer passed to addContent - protected Buffer _date; + protected ByteBuffer _date; private boolean _sendServerVersion; @@ -101,7 +104,7 @@ public abstract class AbstractGenerator implements Generator { _state = STATE_HEADER; _status = 0; - _version = HttpVersions.HTTP_1_1_ORDINAL; + _version = HttpVersion.HTTP_1_1; _reason = null; _last = false; _head = false; @@ -167,7 +170,7 @@ public abstract class AbstractGenerator implements Generator _buffer=_buffers.getBuffer(); if (contentBufferSize > _buffer.capacity()) { - Buffer nb = _buffers.getBuffer(contentBufferSize); + ByteBuffer nb = _buffers.getBuffer(contentBufferSize); nb.put(_buffer); _buffers.returnBuffer(_buffer); _buffer = nb; @@ -175,7 +178,7 @@ public abstract class AbstractGenerator implements Generator } /* ------------------------------------------------------------ */ - public Buffer getUncheckedBuffer() + public ByteBuffer getUncheckedBuffer() { return _buffer; } @@ -258,7 +261,7 @@ public abstract class AbstractGenerator implements Generator { return _persistent!=null ?_persistent.booleanValue() - :(isRequest()?true:_version>HttpVersions.HTTP_1_0_ORDINAL); + :(isRequest()?true:_version>HttpVersion.HTTP_1_0_ORDINAL); } /* ------------------------------------------------------------ */ @@ -277,7 +280,7 @@ public abstract class AbstractGenerator implements Generator if (_state != STATE_HEADER) throw new IllegalStateException("STATE!=START "+_state); _version = version; - if (_version==HttpVersions.HTTP_0_9_ORDINAL && _method!=null) + if (_version==HttpVersion.HTTP_0_9_ORDINAL && _method!=null) _noContent=true; } @@ -289,9 +292,9 @@ public abstract class AbstractGenerator implements Generator /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.http.Generator#setDate(org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.http.Generator#setDate(org.eclipse.jetty.io.ByteBuffer) */ - public void setDate(Buffer timeStampBuffer) + public void setDate(ByteBuffer timeStampBuffer) { _date=timeStampBuffer; } @@ -301,12 +304,12 @@ public abstract class AbstractGenerator implements Generator */ public void setRequest(String method, String uri) { - if (method==null || HttpMethods.GET.equals(method) ) - _method=HttpMethods.GET_BUFFER; + if (method==null || HttpMethod.GET.equals(method) ) + _method=HttpMethod.GET_BUFFER; else - _method=HttpMethods.CACHE.lookup(method); + _method=HttpMethod.CACHE.lookup(method); _uri=uri; - if (_version==HttpVersions.HTTP_0_9_ORDINAL) + if (_version==HttpVersion.HTTP_0_9_ORDINAL) _noContent=true; } @@ -327,7 +330,7 @@ public abstract class AbstractGenerator implements Generator // TODO don't hard code if (len>1024) len=1024; - _reason=new ByteArrayBuffer(len); + _reason=BufferUtil.allocate(len); for (int i=0;i0 || buffer!=null && buffer.length()>0 || isBufferFull()) { flushBuffer(); @@ -468,7 +471,7 @@ public abstract class AbstractGenerator implements Generator if (content != null) { completeHeader(null, false); - addContent(new View(new ByteArrayBuffer(content)), Generator.LAST); + addContent(new View(BufferUtil.allocate(content)), Generator.LAST); } else { diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/EncodedHttpURI.java b/jetty-http/src/main/java/org/eclipse/jetty/http/EncodedHttpURI.java index 1fa9a5e064b..d090a3ed1a3 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/EncodedHttpURI.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/EncodedHttpURI.java @@ -44,14 +44,14 @@ public class EncodedHttpURI extends HttpURI _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' ) - return HttpSchemes.HTTP.toString(); + return HttpScheme.HTTP.toString(); if (l==6 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' && _raw[_scheme+4]=='s' ) - return HttpSchemes.HTTPS.toString(); + return HttpScheme.HTTPS.toString(); return StringUtil.toString(_raw,_scheme,_authority-_scheme-1,_encoding); } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java index 961c24d1978..503bba6c391 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/Generator.java @@ -15,8 +15,8 @@ package org.eclipse.jetty.http; import java.io.IOException; +import java.nio.ByteBuffer; -import org.eclipse.jetty.io.Buffer; public interface Generator { @@ -29,12 +29,12 @@ public interface Generator * * @param content * @param last - * @throws IllegalArgumentException if content is {@link Buffer#isImmutable immutable}. + * @throws IllegalArgumentException if content is {@link ByteBuffer#isImmutable immutable}. * @throws IllegalStateException If the request is not expecting any more content, * or if the buffers are full and cannot be flushed. * @throws IOException if there is a problem flushing the buffers. */ - void addContent(Buffer content, boolean last) throws IOException; + void addContent(ByteBuffer content, boolean last) throws IOException; /* ------------------------------------------------------------ */ /** @@ -95,7 +95,7 @@ public interface Generator void setPersistent(boolean persistent); - void setDate(Buffer timeStampBuffer); + void setDate(ByteBuffer timeStampBuffer); } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java index a502e72567f..353e02a4713 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpBuffers.java @@ -14,8 +14,6 @@ package org.eclipse.jetty.http; import org.eclipse.jetty.io.Buffers; -import org.eclipse.jetty.io.BuffersFactory; -import org.eclipse.jetty.util.component.AbstractLifeCycle; /* ------------------------------------------------------------ */ /** Abstract Buffer pool. diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java index 3cd6d6d6d6c..131ad3ea8e7 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java @@ -14,26 +14,22 @@ package org.eclipse.jetty.http; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; -import java.util.Collections; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.Enumeration; import java.util.GregorianCalendar; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.NoSuchElementException; import java.util.StringTokenizer; import java.util.TimeZone; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import org.eclipse.jetty.io.BufferDateCache; import org.eclipse.jetty.util.BufferUtil; @@ -41,7 +37,6 @@ import org.eclipse.jetty.util.LazyList; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.StringMap; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -369,7 +364,7 @@ public class HttpFields } /* ------------------------------------------------------------ */ - public Field getField(HttpHeaders header) + public Field getField(HttpHeader header) { return _names.get(header.toString()); } @@ -387,7 +382,7 @@ public class HttpFields } /* -------------------------------------------------------------- */ - public String getStringField(HttpHeaders header) + public String getStringField(HttpHeader header) { return getStringField(header.toString()); } @@ -786,7 +781,7 @@ public class HttpFields name_value_params = buf.toString(); // remove existing set-cookie of same name - Field field = getField(HttpHeaders.SET_COOKIE); + Field field = getField(HttpHeader.SET_COOKIE); Field last=null; while (field!=null) { @@ -794,7 +789,7 @@ public class HttpFields { _fields.remove(field); if (last==null) - _names.put(HttpHeaders.SET_COOKIE.toString(),field._next); + _names.put(HttpHeader.SET_COOKIE.toString(),field._next); else last._next=field._next; break; @@ -803,10 +798,10 @@ public class HttpFields field=field._next; } - add(HttpHeaders.SET_COOKIE.toString(), name_value_params); + add(HttpHeader.SET_COOKIE.toString(), name_value_params); // Expire responses with set-cookie headers so they do not get cached. - put(HttpHeaders.EXPIRES.toString(), __01Jan1970); + put(HttpHeader.EXPIRES.toString(), __01Jan1970); } /* -------------------------------------------------------------- */ @@ -1072,15 +1067,15 @@ public class HttpFields /* ------------------------------------------------------------ */ public void putTo(ByteBuffer buffer) throws IOException { - HttpHeaders header = HttpHeaders.CACHE.get(_name); + HttpHeader header = HttpHeader.CACHE.get(_name); if (header!=null) { buffer.put(header.toBuffer()); buffer.put(__colon_space); - if (HttpHeaderValues.hasKnownValues(header)) + if (HttpHeaderValue.hasKnownValues(header)) { - HttpHeaderValues value=HttpHeaderValues.CACHE.get(_value); + HttpHeaderValue value=HttpHeaderValue.CACHE.get(_value); if (value!=null) buffer.put(value.toBuffer()); else diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java index e0512c6dd0c..aa2e0ae7240 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpGenerator.java @@ -15,11 +15,9 @@ package org.eclipse.jetty.http; import java.io.IOException; import java.io.InterruptedIOException; +import java.nio.ByteBuffer; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferCache.CachedBuffer; import org.eclipse.jetty.io.Buffers; -import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.util.BufferUtil; @@ -41,14 +39,14 @@ public class HttpGenerator extends AbstractGenerator // Build cache of response lines for status private static class Status { - Buffer _reason; - Buffer _schemeCode; - Buffer _responseLine; + byte[] _reason; + byte[] _schemeCode; + byte[] _responseLine; } private static final Status[] __status = new Status[HttpStatus.MAX_CODE+1]; static { - int versionLength=HttpVersions.HTTP_1_1_BUFFER.length(); + int versionLength=HttpVersion.HTTP_1_1.toString().length(); for (int i=0;i<__status.length;i++) { @@ -56,27 +54,29 @@ public class HttpGenerator extends AbstractGenerator if (code==null) continue; String reason=code.getMessage(); - byte[] bytes=new byte[versionLength+5+reason.length()+2]; - HttpVersions.HTTP_1_1_BUFFER.peek(0,bytes, 0, versionLength); - bytes[versionLength+0]=' '; - bytes[versionLength+1]=(byte)('0'+i/100); - bytes[versionLength+2]=(byte)('0'+(i%100)/10); - bytes[versionLength+3]=(byte)('0'+(i%10)); - bytes[versionLength+4]=' '; + byte[] line=new byte[versionLength+5+reason.length()+2]; + HttpVersion.HTTP_1_1.toBuffer().get(line,0,versionLength); + line[versionLength+0]=' '; + line[versionLength+1]=(byte)('0'+i/100); + line[versionLength+2]=(byte)('0'+(i%100)/10); + line[versionLength+3]=(byte)('0'+(i%10)); + line[versionLength+4]=' '; for (int j=0;jcontent is {@link Buffer#isImmutable immutable}. + * @throws IllegalArgumentException if content is {@link ByteBuffer#isImmutable immutable}. * @throws IllegalStateException If the request is not expecting any more content, * or if the buffers are full and cannot be flushed. * @throws IOException if there is a problem flushing the buffers. */ - public void addContent(Buffer content, boolean last) throws IOException + public void addContent(ByteBuffer content, boolean last) throws IOException { if (_noContent) throw new IllegalStateException("NO CONTENT"); @@ -179,14 +179,14 @@ public class HttpGenerator extends AbstractGenerator _last = last; // Handle any unfinished business? - if (_content!=null && _content.length()>0 || _bufferChunked) + if (_content!=null && _content.hasRemaining() || _bufferChunked) { if (_endp.isOutputShutdown()) throw new EofException(); flushBuffer(); - if (_content != null && _content.length()>0) + if (_content != null && _content.hasRemaining()) { - Buffer nc=_buffers.getBuffer(_content.length()+content.length()); + ByteBuffer nc=_buffers.getBuffer(_content.remaining()+content.length()); nc.put(_content); nc.put(content); content=nc; @@ -202,7 +202,7 @@ public class HttpGenerator extends AbstractGenerator content.clear(); _content=null; } - else if (_endp != null && (_buffer==null || _buffer.length()==0) && _content.length() > 0 && (_last || isCommitted() && _content.length()>1024)) + else if (_endp != null && (_buffer==null || _buffer.remaining()==0) && _content.remaining() > 0 && (_last || isCommitted() && _content.remaining()>1024)) { _bypass = true; } @@ -215,7 +215,7 @@ public class HttpGenerator extends AbstractGenerator // Copy _content to buffer; int len=_buffer.put(_content); _content.skip(len); - if (_content.length() == 0) + if (_content.remaining() == 0) _content = null; } } @@ -226,9 +226,9 @@ public class HttpGenerator extends AbstractGenerator * * @param response */ - public void sendResponse(Buffer response) throws IOException + public void sendResponse(ByteBuffer response) throws IOException { - if (_noContent || _state!=STATE_HEADER || _content!=null && _content.length()>0 || _bufferChunked || _head ) + if (_noContent || _state!=STATE_HEADER || _content!=null && _content.hasRemaining() || _bufferChunked || _head ) throw new IllegalStateException(); _last = true; @@ -262,10 +262,10 @@ public class HttpGenerator extends AbstractGenerator } // Handle any unfinished business? - if (_content != null && _content.length()>0 || _bufferChunked) + if (_content != null && _content.hasRemaining() || _bufferChunked) { flushBuffer(); - if (_content != null && _content.length()>0 || _bufferChunked) + if (_content != null && _content.hasRemaining() || _bufferChunked) throw new IllegalStateException("FULL"); } @@ -301,7 +301,7 @@ public class HttpGenerator extends AbstractGenerator return -1; // Handle any unfinished business? - Buffer content = _content; + ByteBuffer content = _content; if (content != null && content.length()>0 || _bufferChunked) { flushBuffer(); @@ -313,7 +313,7 @@ public class HttpGenerator extends AbstractGenerator if (_buffer == null) _buffer = _buffers.getBuffer(); - _contentWritten-=_buffer.length(); + _contentWritten-=_buffer.remaining(); // Handle the _content if (_head) @@ -352,7 +352,7 @@ public class HttpGenerator extends AbstractGenerator try { // nasty semi busy flush! - while(_header.length()>0) + while(_header.remaining()>0) { int len = _endp.flush(_header); if (len<0) @@ -409,7 +409,7 @@ public class HttpGenerator extends AbstractGenerator { _persistent=true; - if (_version == HttpVersions.HTTP_0_9_ORDINAL) + if (_version == HttpVersion.HTTP_0_9_ORDINAL) { _contentLength = HttpTokens.NO_CONTENT; _header.put(_method); @@ -426,14 +426,14 @@ public class HttpGenerator extends AbstractGenerator _header.put((byte)' '); _header.put(_uri.getBytes("UTF-8")); // TODO check _header.put((byte)' '); - _header.put(_version==HttpVersions.HTTP_1_0_ORDINAL?HttpVersions.HTTP_1_0_BUFFER:HttpVersions.HTTP_1_1_BUFFER); + _header.put(_version==HttpVersion.HTTP_1_0_ORDINAL?HttpVersion.HTTP_1_0_BUFFER:HttpVersion.HTTP_1_1_BUFFER); _header.put(HttpTokens.CRLF); } } else { // Responses - if (_version == HttpVersions.HTTP_0_9_ORDINAL) + if (_version == HttpVersion.HTTP_0_9_ORDINAL) { _persistent = false; _contentLength = HttpTokens.EOF_CONTENT; @@ -443,14 +443,14 @@ public class HttpGenerator extends AbstractGenerator else { if (_persistent==null) - _persistent= (_version > HttpVersions.HTTP_1_0_ORDINAL); + _persistent= (_version > HttpVersion.HTTP_1_0_ORDINAL); // add response line Status status = _status<__status.length?__status[_status]:null; if (status==null) { - _header.put(HttpVersions.HTTP_1_1_BUFFER); + _header.put(HttpVersion.HTTP_1_1_BUFFER); _header.put((byte) ' '); _header.put((byte) ('0' + _status / 100)); _header.put((byte) ('0' + (_status % 100) / 10)); @@ -506,7 +506,7 @@ public class HttpGenerator extends AbstractGenerator // Add headers if (_status>=200 && _date!=null) { - _header.put(HttpHeaders.DATE_BUFFER); + _header.put(HttpHeader.DATE_BUFFER); _header.put((byte)':'); _header.put((byte)' '); _header.put(_date); @@ -532,7 +532,7 @@ public class HttpGenerator extends AbstractGenerator switch (field.getNameOrdinal()) { - case HttpHeaders.CONTENT_LENGTH_ORDINAL: + case HttpHeader.CONTENT_LENGTH_ORDINAL: content_length = field; _contentLength = field.getLongValue(); @@ -543,7 +543,7 @@ public class HttpGenerator extends AbstractGenerator field.putTo(_header); break; - case HttpHeaders.CONTENT_TYPE_ORDINAL: + case HttpHeader.CONTENT_TYPE_ORDINAL: if (BufferUtil.isPrefix(MimeTypes.MULTIPART_BYTERANGES_BUFFER, field.getValueBuffer())) _contentLength = HttpTokens.SELF_DEFINING_CONTENT; // write the field to the header buffer @@ -551,13 +551,13 @@ public class HttpGenerator extends AbstractGenerator field.putTo(_header); break; - case HttpHeaders.TRANSFER_ENCODING_ORDINAL: - if (_version == HttpVersions.HTTP_1_1_ORDINAL) + case HttpHeader.TRANSFER_ENCODING_ORDINAL: + if (_version == HttpVersion.HTTP_1_1_ORDINAL) transfer_encoding = field; // Do NOT add yet! break; - case HttpHeaders.CONNECTION_ORDINAL: + case HttpHeader.CONNECTION_ORDINAL: if (isRequest()) field.putTo(_header); @@ -569,13 +569,13 @@ public class HttpGenerator extends AbstractGenerator String[] values = field.getValue().split(","); for (int i=0;values!=null && i0 || content_type ) && !_noContent) { // known length but not actually set. - _header.put(HttpHeaders.CONTENT_LENGTH_BUFFER); + _header.put(HttpHeader.CONTENT_LENGTH_BUFFER); _header.put(HttpTokens.COLON); _header.put((byte) ' '); BufferUtil.putDecLong(_header, _contentLength); @@ -704,7 +704,7 @@ public class HttpGenerator extends AbstractGenerator else { // No idea, so we must assume that a body is coming - _contentLength = (!_persistent || _version < HttpVersions.HTTP_1_1_ORDINAL ) ? HttpTokens.EOF_CONTENT : HttpTokens.CHUNKED_CONTENT; + _contentLength = (!_persistent || _version < HttpVersion.HTTP_1_1_ORDINAL ) ? HttpTokens.EOF_CONTENT : HttpTokens.CHUNKED_CONTENT; if (isRequest() && _contentLength==HttpTokens.EOF_CONTENT) { _contentLength=HttpTokens.NO_CONTENT; @@ -734,10 +734,10 @@ public class HttpGenerator extends AbstractGenerator if (_contentLength == HttpTokens.CHUNKED_CONTENT) { // try to use user supplied encoding as it may have other values. - if (transfer_encoding != null && HttpHeaderValues.CHUNKED_ORDINAL != transfer_encoding.getValueOrdinal()) + if (transfer_encoding != null && HttpHeaderValue.CHUNKED_ORDINAL != transfer_encoding.getValueOrdinal()) { String c = transfer_encoding.getValue(); - if (c.endsWith(HttpHeaderValues.CHUNKED)) + if (c.endsWith(HttpHeaderValue.CHUNKED)) transfer_encoding.putTo(_header); else throw new IllegalArgumentException("BAD TE"); @@ -755,7 +755,7 @@ public class HttpGenerator extends AbstractGenerator if (isResponse()) { - if (!_persistent && (close || _version > HttpVersions.HTTP_1_0_ORDINAL)) + if (!_persistent && (close || _version > HttpVersion.HTTP_1_0_ORDINAL)) { _header.put(CONNECTION_CLOSE); if (connection!=null) @@ -898,7 +898,7 @@ public class HttpGenerator extends AbstractGenerator // Special case handling for small left over buffer from // an addContent that caused a buffer flush. - if (_content != null && _content.length() < _buffer.space() && _state != STATE_FLUSHING) + if (_content != null && _content.remaining() < _buffer.space() && _state != STATE_FLUSHING) { _buffer.put(_content); _content.clear(); @@ -908,7 +908,7 @@ public class HttpGenerator extends AbstractGenerator } // Are we completely finished for now? - if (!_needCRLF && !_needEOC && (_content==null || _content.length()==0)) + if (!_needCRLF && !_needEOC && (_content==null || _content.remaining()==0)) { if (_state == STATE_FLUSHING) _state = STATE_END; @@ -943,9 +943,9 @@ public class HttpGenerator extends AbstractGenerator /* ------------------------------------------------------------ */ private int flushMask() { - return ((_header != null && _header.length() > 0)?4:0) - | ((_buffer != null && _buffer.length() > 0)?2:0) - | ((_bypass && _content != null && _content.length() > 0)?1:0); + return ((_header != null && _header.remaining() > 0)?4:0) + | ((_buffer != null && _buffer.remaining() > 0)?2:0) + | ((_bypass && _content != null && _content.remaining() > 0)?1:0); } /* ------------------------------------------------------------ */ @@ -955,21 +955,21 @@ public class HttpGenerator extends AbstractGenerator if (!_bufferChunked) { // Refill buffer if possible - if (!_bypass && _content != null && _content.length() > 0 && _buffer != null && _buffer.space() > 0) + if (!_bypass && _content != null && _content.remaining() > 0 && _buffer != null && _buffer.space() > 0) { int len = _buffer.put(_content); _content.skip(len); - if (_content.length() == 0) + if (_content.remaining() == 0) _content = null; } // Chunk buffer if need be if (_contentLength == HttpTokens.CHUNKED_CONTENT) { - if (_bypass && (_buffer==null||_buffer.length()==0) && _content!=null) + if (_bypass && (_buffer==null||_buffer.remaining()==0) && _content!=null) { // this is a bypass write - int size = _content.length(); + int size = _content.remaining(); _bufferChunked = true; if (_header == null) @@ -978,7 +978,7 @@ public class HttpGenerator extends AbstractGenerator // if we need CRLF add this to header if (_needCRLF) { - if (_header.length() > 0) throw new IllegalStateException("EOC"); + if (_header.remaining() > 0) throw new IllegalStateException("EOC"); _header.put(HttpTokens.CRLF); _needCRLF = false; } @@ -991,7 +991,7 @@ public class HttpGenerator extends AbstractGenerator } else if (_buffer!=null) { - int size = _buffer.length(); + int size = _buffer.remaining(); if (size > 0) { // Prepare a chunk! @@ -1021,7 +1021,7 @@ public class HttpGenerator extends AbstractGenerator if (_needCRLF) { - if (_header.length() > 0) throw new IllegalStateException("EOC"); + if (_header.remaining() > 0) throw new IllegalStateException("EOC"); _header.put(HttpTokens.CRLF); _needCRLF = false; } @@ -1038,7 +1038,7 @@ public class HttpGenerator extends AbstractGenerator } // If we need EOC and everything written - if (_needEOC && (_content == null || _content.length() == 0)) + if (_needEOC && (_content == null || _content.remaining() == 0)) { if (_needCRLF) { @@ -1079,23 +1079,23 @@ public class HttpGenerator extends AbstractGenerator } } - if (_content != null && _content.length() == 0) + if (_content != null && _content.remaining() == 0) _content = null; } public int getBytesBuffered() { - return(_header==null?0:_header.length())+ - (_buffer==null?0:_buffer.length())+ - (_content==null?0:_content.length()); + return(_header==null?0:_header.remaining())+ + (_buffer==null?0:_buffer.remaining())+ + (_content==null?0:_content.remaining()); } public boolean isEmpty() { - return (_header==null||_header.length()==0) && - (_buffer==null||_buffer.length()==0) && - (_content==null||_content.length()==0); + return (_header==null||_header.remaining()==0) && + (_buffer==null||_buffer.remaining()==0) && + (_content==null||_content.remaining()==0); } @Override @@ -1104,8 +1104,8 @@ public class HttpGenerator extends AbstractGenerator return String.format("%s{s=%d,h=%d,b=%d,c=%d}", getClass().getSimpleName(), _state, - _header == null ? -1 : _header.length(), - _buffer == null ? -1 : _buffer.length(), - _content == null ? -1 : _content.length()); + _header == null ? -1 : _header.remaining(), + _buffer == null ? -1 : _buffer.remaining(), + _content == null ? -1 : _content.remaining()); } } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaders.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeader.java similarity index 94% rename from jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaders.java rename to jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeader.java index 35871058d11..b8d92c6ba1b 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaders.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeader.java @@ -19,7 +19,7 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringMap; -public enum HttpHeaders +public enum HttpHeader { /* ------------------------------------------------------------ */ /** General Fields. @@ -105,10 +105,10 @@ public enum HttpHeaders /* ------------------------------------------------------------ */ - public final static StringMap CACHE= new StringMap(true); + public final static StringMap CACHE= new StringMap(true); static { - for (HttpHeaders header : HttpHeaders.values()) + for (HttpHeader header : HttpHeader.values()) CACHE.put(header.toString(),header); } @@ -116,7 +116,7 @@ public enum HttpHeaders private final ByteBuffer _buffer; /* ------------------------------------------------------------ */ - HttpHeaders(String s) + HttpHeader(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); @@ -136,7 +136,7 @@ public enum HttpHeaders public static void main (String[] args) { - for (HttpHeaders h : HttpHeaders.values()) + for (HttpHeader h : HttpHeader.values()) { System.err.println("\n\n"+h); CACHE.get(h.toString()); diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaderValues.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaderValue.java similarity index 79% rename from jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaderValues.java rename to jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaderValue.java index 1849fa96bda..8e68cdbe335 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaderValues.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpHeaderValue.java @@ -14,9 +14,7 @@ package org.eclipse.jetty.http; import java.nio.ByteBuffer; -import java.util.EnumMap; import java.util.EnumSet; -import java.util.Map; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringMap; @@ -25,7 +23,7 @@ import org.eclipse.jetty.util.StringMap; /** * */ -public enum HttpHeaderValues +public enum HttpHeaderValue { CLOSE("close"), CHUNKED("chunked"), @@ -40,10 +38,10 @@ public enum HttpHeaderValues UPGRADE("Upgrade"); /* ------------------------------------------------------------ */ - public final static StringMap CACHE= new StringMap(true); + public final static StringMap CACHE= new StringMap(true); static { - for (HttpHeaderValues value : HttpHeaderValues.values()) + for (HttpHeaderValue value : HttpHeaderValue.values()) CACHE.put(value.toString(),value); } @@ -51,7 +49,7 @@ public enum HttpHeaderValues private final ByteBuffer _buffer; /* ------------------------------------------------------------ */ - HttpHeaderValues(String s) + HttpHeaderValue(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); @@ -70,13 +68,13 @@ public enum HttpHeaderValues } /* ------------------------------------------------------------ */ - private static EnumSet __known = - EnumSet.of(HttpHeaders.CONNECTION, - HttpHeaders.TRANSFER_ENCODING, - HttpHeaders.CONTENT_ENCODING); + private static EnumSet __known = + EnumSet.of(HttpHeader.CONNECTION, + HttpHeader.TRANSFER_ENCODING, + HttpHeader.CONTENT_ENCODING); /* ------------------------------------------------------------ */ - public static boolean hasKnownValues(HttpHeaders header) + public static boolean hasKnownValues(HttpHeader header) { if (header==null) return false; diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpMethods.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpMethod.java similarity index 89% rename from jetty-http/src/main/java/org/eclipse/jetty/http/HttpMethods.java rename to jetty-http/src/main/java/org/eclipse/jetty/http/HttpMethod.java index 0e9a9b54a56..52e79a05725 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpMethods.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpMethod.java @@ -22,7 +22,7 @@ import org.eclipse.jetty.util.StringMap; /* ------------------------------------------------------------------------------- */ /** */ -public enum HttpMethods +public enum HttpMethod { GET, POST, @@ -35,10 +35,10 @@ public enum HttpMethods MOVE; /* ------------------------------------------------------------ */ - public final static StringMap CACHE= new StringMap(true); + public final static StringMap CACHE= new StringMap(true); static { - for (HttpMethods method : HttpMethods.values()) + for (HttpMethod method : HttpMethod.values()) CACHE.put(method.toString(),method); } @@ -46,7 +46,7 @@ public enum HttpMethods private final ByteBuffer _buffer; /* ------------------------------------------------------------ */ - HttpMethods() + HttpMethod() { _buffer=BufferUtil.toBuffer(toString()); } 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 b14cbc32905..0aba5d34042 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 @@ -22,7 +22,7 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -public class HttpParser implements Parser +public class HttpParser { private static final Logger LOG = Log.getLogger(HttpParser.class); @@ -56,8 +56,8 @@ public class HttpParser implements Parser private final EventHandler _handler; private final RequestHandler _requestHandler; private final ResponseHandler _responseHandler; - private HttpHeaders _header; - private HttpHeaderValues _value; + private HttpHeader _header; + private HttpHeaderValue _value; private int _responseStatus; private boolean _persistent; @@ -249,7 +249,7 @@ public class HttpParser implements Parser case METHOD: if (ch == HttpTokens.SPACE) { - HttpMethods method=HttpMethods.CACHE.get(buffer,start,buffer.position()-start-1); + HttpMethod method=HttpMethod.CACHE.get(buffer,start,buffer.position()-start-1); _field0=method==null?BufferUtil.toString(buffer,start,buffer.position()-start-1,StringUtil.__ISO_8859_1_CHARSET):method.toString(); _state=State.SPACE1; } @@ -262,10 +262,10 @@ public class HttpParser implements Parser case RESPONSE_VERSION: if (ch == HttpTokens.SPACE) { - HttpVersions v=HttpVersions.CACHE.get(buffer,start,buffer.position()-start-1); + HttpVersion v=HttpVersion.CACHE.get(buffer,start,buffer.position()-start-1); _field0=v==null?BufferUtil.toString(buffer,start,buffer.position()-start-1,StringUtil.__ISO_8859_1_CHARSET):v.toString(); start=-1; - _persistent=HttpVersions.HTTP_1_1==v; + _persistent=HttpVersion.HTTP_1_1==v; _state=State.SPACE1; } else if (ch < HttpTokens.SPACE && ch>=0) @@ -369,13 +369,13 @@ public class HttpParser implements Parser case REQUEST_VERSION: if (ch == HttpTokens.CARRIAGE_RETURN || ch == HttpTokens.LINE_FEED) { - HttpVersions v=HttpVersions.CACHE.get(buffer,start,buffer.position()-start-1); + HttpVersion v=HttpVersion.CACHE.get(buffer,start,buffer.position()-start-1); String version=v==null?BufferUtil.toString(buffer,start,buffer.position()-start-1,StringUtil.__ISO_8859_1_CHARSET):v.toString(); start=-1; at_next|=_requestHandler.startRequest(_field0, _field1, version); _eol=ch; - _persistent=HttpVersions.HTTP_1_1==v; + _persistent=HttpVersion.HTTP_1_1==v; _state=State.HEADER; _field0=_field1=null; continue; @@ -437,13 +437,13 @@ public class HttpParser implements Parser break; case TRANSFER_ENCODING: - if (_value==HttpHeaderValues.CHUNKED) + if (_value==HttpHeaderValue.CHUNKED) _contentLength=HttpTokens.CHUNKED_CONTENT; else { - if (_field1.endsWith(HttpHeaderValues.CHUNKED.toString())) + if (_field1.endsWith(HttpHeaderValue.CHUNKED.toString())) _contentLength=HttpTokens.CHUNKED_CONTENT; - else if (_field1.indexOf(HttpHeaderValues.CHUNKED.toString()) >= 0) + else if (_field1.indexOf(HttpHeaderValue.CHUNKED.toString()) >= 0) throw new HttpException(400,null); } break; @@ -463,7 +463,7 @@ public class HttpParser implements Parser { for (String v : _field1.toString().split(",")) { - switch(HttpHeaderValues.CACHE.get(v.trim())) + switch(HttpHeaderValue.CACHE.get(v.trim())) { case CLOSE: _persistent=false; @@ -551,14 +551,14 @@ public class HttpParser implements Parser case HttpTokens.CARRIAGE_RETURN: case HttpTokens.LINE_FEED: _eol=ch; - _header=HttpHeaders.CACHE.get(buffer,start,length); + _header=HttpHeader.CACHE.get(buffer,start,length); _field0=_header==null?BufferUtil.toString(buffer,start,length,StringUtil.__ISO_8859_1_CHARSET):_header.toString(); start=length=-1; _state=State.HEADER; break; case HttpTokens.COLON: - _header=HttpHeaders.CACHE.get(buffer,start,length); + _header=HttpHeader.CACHE.get(buffer,start,length); _field0=_header==null?BufferUtil.toString(buffer,start,length,StringUtil.__ISO_8859_1_CHARSET):_header.toString(); start=length=-1; _state=State.HEADER_VALUE; @@ -581,14 +581,14 @@ public class HttpParser implements Parser case HttpTokens.CARRIAGE_RETURN: case HttpTokens.LINE_FEED: _eol=ch; - _header=HttpHeaders.CACHE.get(buffer,start,length); + _header=HttpHeader.CACHE.get(buffer,start,length); _field0=_header==null?BufferUtil.toString(buffer,start,length,StringUtil.__ISO_8859_1_CHARSET):_header.toString(); start=length=-1; _state=State.HEADER; break; case HttpTokens.COLON: - _header=HttpHeaders.CACHE.get(buffer,start,length); + _header=HttpHeader.CACHE.get(buffer,start,length); _field0=_header==null?BufferUtil.toString(buffer,start,length,StringUtil.__ISO_8859_1_CHARSET):_header.toString(); start=length=-1; _state=State.HEADER_VALUE; @@ -616,9 +616,9 @@ public class HttpParser implements Parser _value=null; _field1+=" "+BufferUtil.toString(buffer,start,length,StringUtil.__ISO_8859_1_CHARSET); } - else if (HttpHeaderValues.hasKnownValues(_header)) + else if (HttpHeaderValue.hasKnownValues(_header)) { - _value=HttpHeaderValues.CACHE.get(buffer,start,length); + _value=HttpHeaderValue.CACHE.get(buffer,start,length); _field1=_value.toString(); } else @@ -659,9 +659,9 @@ public class HttpParser implements Parser _value=null; _field1+=" "+BufferUtil.toString(buffer,start,length,StringUtil.__ISO_8859_1_CHARSET); } - else if (HttpHeaderValues.hasKnownValues(_header)) + else if (HttpHeaderValue.hasKnownValues(_header)) { - _value=HttpHeaderValues.CACHE.get(buffer,start,length); + _value=HttpHeaderValue.CACHE.get(buffer,start,length); _field1=_value.toString(); } else diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpSchemes.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpScheme.java similarity index 89% rename from jetty-http/src/main/java/org/eclipse/jetty/http/HttpSchemes.java rename to jetty-http/src/main/java/org/eclipse/jetty/http/HttpScheme.java index bc3597a6090..beaa36a495e 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpSchemes.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpScheme.java @@ -21,7 +21,7 @@ import org.eclipse.jetty.util.StringMap; /* ------------------------------------------------------------------------------- */ /** */ -public enum HttpSchemes +public enum HttpScheme { HTTP("http"), HTTPS("https"), @@ -29,10 +29,10 @@ public enum HttpSchemes WSS("wss"); /* ------------------------------------------------------------ */ - public final static StringMap CACHE= new StringMap(true); + public final static StringMap CACHE= new StringMap(true); static { - for (HttpSchemes version : HttpSchemes.values()) + for (HttpScheme version : HttpScheme.values()) CACHE.put(version.toString(),version); } @@ -40,7 +40,7 @@ public enum HttpSchemes private final ByteBuffer _buffer; /* ------------------------------------------------------------ */ - HttpSchemes(String s) + HttpScheme(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java index fae3fcaeddf..17a59dec53a 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java @@ -502,14 +502,14 @@ public class HttpURI _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' ) - return HttpSchemes.HTTP.toString(); + return HttpScheme.HTTP.toString(); if (l==6 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' && _raw[_scheme+4]=='s' ) - return HttpSchemes.HTTPS.toString(); + return HttpScheme.HTTPS.toString(); return toUtf8String(_scheme,_authority-_scheme-1); } diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpVersions.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpVersion.java similarity index 90% rename from jetty-http/src/main/java/org/eclipse/jetty/http/HttpVersions.java rename to jetty-http/src/main/java/org/eclipse/jetty/http/HttpVersion.java index 5941f697e3f..97f6b7f779f 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpVersions.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpVersion.java @@ -20,17 +20,17 @@ import org.eclipse.jetty.util.StringMap; /* ------------------------------------------------------------------------------- */ -public enum HttpVersions +public enum HttpVersion { HTTP_0_9("HTTP/0.9",9), HTTP_1_0("HTTP/1.0",10), HTTP_1_1("HTTP/1.1",11); /* ------------------------------------------------------------ */ - public final static StringMap CACHE= new StringMap(true); + public final static StringMap CACHE= new StringMap(true); static { - for (HttpVersions version : HttpVersions.values()) + for (HttpVersion version : HttpVersion.values()) CACHE.put(version.toString(),version); } @@ -39,7 +39,7 @@ public enum HttpVersions private final int _version; /* ------------------------------------------------------------ */ - HttpVersions(String s,int version) + HttpVersion(String s,int version) { _string=s; _buffer=BufferUtil.toBuffer(s); diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/Parser.java b/jetty-http/src/main/java/org/eclipse/jetty/http/Parser.java deleted file mode 100644 index 883b99d9333..00000000000 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/Parser.java +++ /dev/null @@ -1,45 +0,0 @@ -// ======================================================================== -// Copyright (c) 2006-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; - -import java.io.IOException; -import java.nio.ByteBuffer; - -/** - * Abstract interface for a connection Parser for use by Jetty. - */ -public interface Parser -{ - void reset(); - - boolean isComplete(); - - - /* ------------------------------------------------------------ */ - /** - * @param buffer - * @return True if parsed to the next unit - * @throws IOException - */ - boolean parseNext(ByteBuffer buffer) throws IOException; - - boolean onEOF()throws IOException; - - boolean isIdle(); - - boolean isPersistent(); - - void setPersistent(boolean persistent); - -} diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java index 8c0111d2cb5..fce89d199c1 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java @@ -13,7 +13,6 @@ package org.eclipse.jetty.http; -import java.io.Externalizable; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java index 8cb9ddf9f2b..6b043b5c999 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java @@ -22,7 +22,6 @@ import java.nio.ByteBuffer; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; -import java.util.regex.Matcher; import org.eclipse.jetty.util.BufferUtil; import org.junit.Assert; @@ -112,9 +111,9 @@ public class HttpFieldsTest buffer.flip(); String out = BufferUtil.toString(buffer); - Assert.assertThat(out,JUnitMatchers.containsString(HttpHeaders.CONNECTION+": "+HttpHeaderValues.KEEP_ALIVE)); - Assert.assertThat(out,JUnitMatchers.containsString(HttpHeaders.TRANSFER_ENCODING+": "+HttpHeaderValues.CHUNKED)); - Assert.assertThat(out,JUnitMatchers.containsString(HttpHeaders.CONTENT_ENCODING+": "+HttpHeaderValues.GZIP)); + Assert.assertThat(out,JUnitMatchers.containsString(HttpHeader.CONNECTION+": "+HttpHeaderValue.KEEP_ALIVE)); + Assert.assertThat(out,JUnitMatchers.containsString(HttpHeader.TRANSFER_ENCODING+": "+HttpHeaderValue.CHUNKED)); + Assert.assertThat(out,JUnitMatchers.containsString(HttpHeader.CONTENT_ENCODING+": "+HttpHeaderValue.GZIP)); 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 55550f723c3..71f9a70d99b 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 @@ -17,12 +17,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.nio.ByteBuffer; + +import javax.swing.text.View; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.io.SimpleBuffers; -import org.eclipse.jetty.io.View; import org.junit.Test; public class HttpGeneratorClientTest @@ -33,8 +33,8 @@ public class HttpGeneratorClientTest @Test public void testContentLength() throws Exception { - Buffer bb=new ByteArrayBuffer(8096); - Buffer sb=new ByteArrayBuffer(1500); + ByteBuffer bb=new ByteArrayBuffer(8096); + ByteBuffer sb=new ByteArrayBuffer(1500); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); HttpGenerator generator = new HttpGenerator(new SimpleBuffers(sb,bb),endp); @@ -61,8 +61,8 @@ public class HttpGeneratorClientTest @Test public void testAutoContentLength() throws Exception { - Buffer bb=new ByteArrayBuffer(8096); - Buffer sb=new ByteArrayBuffer(1500); + ByteBuffer bb=new ByteArrayBuffer(8096); + ByteBuffer sb=new ByteArrayBuffer(1500); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); HttpGenerator generator = new HttpGenerator(new SimpleBuffers(sb,bb),endp); @@ -88,8 +88,8 @@ public class HttpGeneratorClientTest @Test public void testChunked() throws Exception { - Buffer bb=new ByteArrayBuffer(8096); - Buffer sb=new ByteArrayBuffer(1500); + ByteBuffer bb=new ByteArrayBuffer(8096); + ByteBuffer sb=new ByteArrayBuffer(1500); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); HttpGenerator generator = new HttpGenerator(new SimpleBuffers(sb,bb),endp); @@ -115,8 +115,8 @@ public class HttpGeneratorClientTest @Test public void testHTTP() throws Exception { - Buffer bb=new ByteArrayBuffer(8096); - Buffer sb=new ByteArrayBuffer(1500); + ByteBuffer bb=new ByteArrayBuffer(8096); + ByteBuffer sb=new ByteArrayBuffer(1500); HttpFields fields = new HttpFields(); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); HttpGenerator hb = new HttpGenerator(new SimpleBuffers(sb,bb),endp); @@ -212,7 +212,7 @@ public class HttpGeneratorClientTest values[2]=connection; values[3]=te; - hb.setRequest(HttpMethods.GET,"/context/path/info"); + hb.setRequest(HttpMethod.GET,"/context/path/info"); hb.setVersion(version); for (int i=0;i hostPort.getIndex();) @@ -1207,7 +1207,7 @@ public class Request implements HttpServletRequest * * @return The time that the request was received. */ - public Buffer getTimeStampBuffer() + public ByteBuffer getTimeStampBuffer() { if (_timeStampBuffer == null && _timeStamp > 0) _timeStampBuffer = HttpFields.__dateCache.formatBuffer(_timeStamp); @@ -1404,7 +1404,7 @@ public class Request implements HttpServletRequest _method = null; _pathInfo = null; _port = 0; - _protocol = HttpVersions.HTTP_1_1; + _protocol = HttpVersion.HTTP_1_1; _queryEncoding = null; _queryString = null; _requestedSessionId = null; @@ -1627,7 +1627,7 @@ public class Request implements HttpServletRequest */ public void setContentType(String contentType) { - _connection.getRequestFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,contentType); + _connection.getRequestFields().put(HttpHeader.CONTENT_TYPE_BUFFER,contentType); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java index 949f641e5ef..f0b4b742769 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java @@ -27,7 +27,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jetty.http.HttpContent; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.MimeTypes; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.View; import org.eclipse.jetty.io.nio.DirectNIOBuffer; @@ -286,7 +286,7 @@ public class ResourceCache } /* ------------------------------------------------------------ */ - protected Buffer getIndirectBuffer(Resource resource) + protected ByteBuffer getIndirectBuffer(Resource resource) { try { @@ -296,7 +296,7 @@ public class ResourceCache LOG.warn("invalid resource: "+String.valueOf(resource)+" "+len); return null; } - Buffer buffer = new IndirectNIOBuffer(len); + ByteBuffer buffer = new IndirectNIOBuffer(len); InputStream is = resource.getInputStream(); buffer.readFrom(is,len); is.close(); @@ -310,7 +310,7 @@ public class ResourceCache } /* ------------------------------------------------------------ */ - protected Buffer getDirectBuffer(Resource resource) + protected ByteBuffer getDirectBuffer(Resource resource) { try { @@ -323,7 +323,7 @@ public class ResourceCache LOG.warn("invalid resource: "+String.valueOf(resource)+" "+len); return null; } - Buffer buffer = new DirectNIOBuffer(len); + ByteBuffer buffer = new DirectNIOBuffer(len); InputStream is = resource.getInputStream(); buffer.readFrom(is,len); is.close(); @@ -352,12 +352,12 @@ public class ResourceCache final int _length; final String _key; final long _lastModified; - final Buffer _lastModifiedBytes; - final Buffer _contentType; + final ByteBuffer _lastModifiedBytes; + final ByteBuffer _contentType; volatile long _lastAccessed; - AtomicReference _indirectBuffer=new AtomicReference(); - AtomicReference _directBuffer=new AtomicReference(); + AtomicReference _indirectBuffer=new AtomicReference(); + AtomicReference _directBuffer=new AtomicReference(); /* ------------------------------------------------------------ */ Content(String pathInContext,Resource resource) @@ -425,13 +425,13 @@ public class ResourceCache } /* ------------------------------------------------------------ */ - public Buffer getLastModified() + public ByteBuffer getLastModified() { return _lastModifiedBytes; } /* ------------------------------------------------------------ */ - public Buffer getContentType() + public ByteBuffer getContentType() { return _contentType; } @@ -443,12 +443,12 @@ public class ResourceCache } /* ------------------------------------------------------------ */ - public Buffer getIndirectBuffer() + public ByteBuffer getIndirectBuffer() { - Buffer buffer = _indirectBuffer.get(); + ByteBuffer buffer = _indirectBuffer.get(); if (buffer==null) { - Buffer buffer2=ResourceCache.this.getIndirectBuffer(_resource); + ByteBuffer buffer2=ResourceCache.this.getIndirectBuffer(_resource); if (buffer2==null) LOG.warn("Could not load "+this); @@ -464,12 +464,12 @@ public class ResourceCache /* ------------------------------------------------------------ */ - public Buffer getDirectBuffer() + public ByteBuffer getDirectBuffer() { - Buffer buffer = _directBuffer.get(); + ByteBuffer buffer = _directBuffer.get(); if (buffer==null) { - Buffer buffer2=ResourceCache.this.getDirectBuffer(_resource); + ByteBuffer buffer2=ResourceCache.this.getDirectBuffer(_resource); if (buffer2==null) LOG.warn("Could not load "+this); @@ -493,7 +493,7 @@ public class ResourceCache /* ------------------------------------------------------------ */ public InputStream getInputStream() throws IOException { - Buffer indirect = getIndirectBuffer(); + ByteBuffer indirect = getIndirectBuffer(); if (indirect!=null && indirect.array()!=null) return new ByteArrayInputStream(indirect.array(),indirect.getIndex(),indirect.length()); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index 1fab677acec..fb937ade9bf 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -28,12 +28,12 @@ import javax.servlet.http.HttpSession; import org.eclipse.jetty.http.HttpCookie; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpGenerator; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpURI; -import org.eclipse.jetty.http.HttpVersions; +import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.io.BufferCache.CachedBuffer; import org.eclipse.jetty.server.handler.ContextHandler; @@ -181,7 +181,7 @@ public class Response implements HttpServletResponse path = (path == null?"":path); int port=uri.getPort(); if (port<0) - port = HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme())?443:80; + port = HttpScheme.HTTPS.equalsIgnoreCase(uri.getScheme())?443:80; if (!request.getServerName().equalsIgnoreCase(uri.getHost()) || request.getServerPort()!=port || !path.startsWith(request.getContextPath())) //TODO the root context path is "", with which every non null string starts @@ -250,13 +250,13 @@ public class Response implements HttpServletResponse if (suffix<0) { return url+ - ((HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme()) || HttpSchemes.HTTP.equalsIgnoreCase(uri.getScheme())) && uri.getPath()==null?"/":"") + //if no path, insert the root path + ((HttpScheme.HTTPS.equalsIgnoreCase(uri.getScheme()) || HttpScheme.HTTP.equalsIgnoreCase(uri.getScheme())) && uri.getPath()==null?"/":"") + //if no path, insert the root path sessionURLPrefix+id; } return url.substring(0,suffix)+ - ((HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme()) || HttpSchemes.HTTP.equalsIgnoreCase(uri.getScheme())) && uri.getPath()==null?"/":"")+ //if no path so insert the root path + ((HttpScheme.HTTPS.equalsIgnoreCase(uri.getScheme()) || HttpScheme.HTTP.equalsIgnoreCase(uri.getScheme())) && uri.getPath()==null?"/":"")+ //if no path so insert the root path sessionURLPrefix+id+url.substring(suffix); } @@ -297,11 +297,11 @@ public class Response implements HttpServletResponse resetBuffer(); _characterEncoding=null; - setHeader(HttpHeaders.EXPIRES,null); - setHeader(HttpHeaders.LAST_MODIFIED,null); - setHeader(HttpHeaders.CACHE_CONTROL,null); - setHeader(HttpHeaders.CONTENT_TYPE,null); - setHeader(HttpHeaders.CONTENT_LENGTH,null); + setHeader(HttpHeader.EXPIRES,null); + setHeader(HttpHeader.LAST_MODIFIED,null); + setHeader(HttpHeader.CACHE_CONTROL,null); + setHeader(HttpHeader.CONTENT_TYPE,null); + setHeader(HttpHeader.CONTENT_LENGTH,null); _outputState=NONE; setStatus(code,message); @@ -333,7 +333,7 @@ public class Response implements HttpServletResponse } else { - setHeader(HttpHeaders.CACHE_CONTROL, "must-revalidate,no-cache,no-store"); + setHeader(HttpHeader.CACHE_CONTROL, "must-revalidate,no-cache,no-store"); setContentType(MimeTypes.TEXT_HTML_8859_1); ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(2048); if (message != null) @@ -378,8 +378,8 @@ public class Response implements HttpServletResponse } else if (code!=SC_PARTIAL_CONTENT) { - _connection.getRequestFields().remove(HttpHeaders.CONTENT_TYPE_BUFFER); - _connection.getRequestFields().remove(HttpHeaders.CONTENT_LENGTH_BUFFER); + _connection.getRequestFields().remove(HttpHeader.CONTENT_TYPE_BUFFER); + _connection.getRequestFields().remove(HttpHeader.CONTENT_LENGTH_BUFFER); _characterEncoding=null; _mimeType=null; _cachedMimeType=null; @@ -468,7 +468,7 @@ public class Response implements HttpServletResponse } resetBuffer(); - setHeader(HttpHeaders.LOCATION,location); + setHeader(HttpHeader.LOCATION,location); setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); complete(); @@ -500,7 +500,7 @@ public class Response implements HttpServletResponse */ public void setHeader(String name, String value) { - if (HttpHeaders.CONTENT_TYPE.equalsIgnoreCase(name)) + if (HttpHeader.CONTENT_TYPE.equalsIgnoreCase(name)) setContentType(value); else { @@ -512,7 +512,7 @@ public class Response implements HttpServletResponse return; } _connection.getResponseFields().put(name, value); - if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name)) + if (HttpHeader.CONTENT_LENGTH.equalsIgnoreCase(name)) { if (value==null) _connection._generator.setContentLength(-1); @@ -565,7 +565,7 @@ public class Response implements HttpServletResponse } _connection.getResponseFields().add(name, value); - if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name)) + if (HttpHeader.CONTENT_LENGTH.equalsIgnoreCase(name)) _connection._generator.setContentLength(Long.parseLong(value)); } @@ -578,7 +578,7 @@ public class Response implements HttpServletResponse if (!_connection.isIncluding()) { _connection.getResponseFields().putLongField(name, value); - if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name)) + if (HttpHeader.CONTENT_LENGTH.equalsIgnoreCase(name)) _connection._generator.setContentLength(value); } } @@ -592,7 +592,7 @@ public class Response implements HttpServletResponse if (!_connection.isIncluding()) { _connection.getResponseFields().addLongField(name, value); - if (HttpHeaders.CONTENT_LENGTH.equalsIgnoreCase(name)) + if (HttpHeader.CONTENT_LENGTH.equalsIgnoreCase(name)) _connection._generator.setContentLength(value); } } @@ -727,9 +727,9 @@ public class Response implements HttpServletResponse { _characterEncoding=null; if (_cachedMimeType!=null) - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_cachedMimeType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_cachedMimeType); else - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_mimeType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_mimeType); } } else @@ -748,14 +748,14 @@ public class Response implements HttpServletResponse if (content_type!=null) { _contentType=content_type.toString(); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,content_type); } } if (_contentType==null) { _contentType = _mimeType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= "); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else @@ -774,7 +774,7 @@ public class Response implements HttpServletResponse else _contentType=_contentType.substring(0,i8)+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= ")+_contentType.substring(i2); } - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } } @@ -795,7 +795,7 @@ public class Response implements HttpServletResponse _connection._generator.setContentLength(len); if (len>=0) { - _connection.getResponseFields().putLongField(HttpHeaders.CONTENT_LENGTH, len); + _connection.getResponseFields().putLongField(HttpHeader.CONTENT_LENGTH, len); if (_connection._generator.isAllContentWritten()) { if (_outputState==WRITER) @@ -827,7 +827,7 @@ public class Response implements HttpServletResponse if (isCommitted() || _connection.isIncluding()) return; _connection._generator.setContentLength(len); - _connection.getResponseFields().putLongField(HttpHeaders.CONTENT_LENGTH, len); + _connection.getResponseFields().putLongField(HttpHeader.CONTENT_LENGTH, len); } /* ------------------------------------------------------------ */ @@ -850,7 +850,7 @@ public class Response implements HttpServletResponse _mimeType=null; _cachedMimeType=null; _contentType=null; - _connection.getResponseFields().remove(HttpHeaders.CONTENT_TYPE_BUFFER); + _connection.getResponseFields().remove(HttpHeader.CONTENT_TYPE_BUFFER); } else { @@ -884,29 +884,29 @@ public class Response implements HttpServletResponse if (content_type!=null) { _contentType=content_type.toString(); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,content_type); } else { _contentType=_mimeType+";charset="+_characterEncoding; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else { _contentType=_mimeType+";charset="+_characterEncoding; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else if (i2<0) { _contentType=contentType.substring(0,i1)+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= "); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } else { _contentType=contentType.substring(0,i1)+contentType.substring(i2)+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= "); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else if ((i1==i0+1 && i2<0) || (i1==i0+2 && i2<0 && contentType.charAt(i0+1)==' ')) @@ -921,38 +921,38 @@ public class Response implements HttpServletResponse if (content_type!=null) { _contentType=content_type.toString(); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,content_type); } else { _contentType=contentType; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else { _contentType=contentType; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else if (i2>0) { _characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8,i2)); _contentType=contentType; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } else { _characterEncoding = QuotedStringTokenizer.unquote(contentType.substring(i8)); _contentType=contentType; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else // No encoding in the params. { _cachedMimeType=null; _contentType=_characterEncoding==null?contentType:contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= "); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else // No params at all @@ -968,29 +968,29 @@ public class Response implements HttpServletResponse if (content_type!=null) { _contentType=content_type.toString(); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,content_type); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,content_type); } else { _contentType=_mimeType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= "); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else { _contentType=contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(_characterEncoding,";= "); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } else if (_cachedMimeType!=null) { _contentType=_cachedMimeType.toString(); - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_cachedMimeType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_cachedMimeType); } else { _contentType=contentType; - _connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); + _connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType); } } } @@ -1039,28 +1039,28 @@ public class Response implements HttpServletResponse HttpFields response_fields=_connection.getResponseFields(); response_fields.clear(); - String connection=_connection.getRequestFields().getStringField(HttpHeaders.CONNECTION_BUFFER); + String connection=_connection.getRequestFields().getStringField(HttpHeader.CONNECTION_BUFFER); if (connection!=null) { String[] values = connection.split(","); for (int i=0;values!=null && i context, SocketChannel channel, Buffer buffer) + private ClientToProxyConnection prepareConnections(ConcurrentMap context, SocketChannel channel, ByteBuffer buffer) { AbstractHttpConnection httpConnection = AbstractHttpConnection.getCurrentConnection(); ProxyToServerConnection proxyToServer = newProxyToServerConnection(context, buffer); @@ -302,7 +302,7 @@ public class ConnectHandler extends HandlerWrapper return new ClientToProxyConnection(context, channel, endPoint, timeStamp); } - protected ProxyToServerConnection newProxyToServerConnection(ConcurrentMap context, Buffer buffer) + protected ProxyToServerConnection newProxyToServerConnection(ConcurrentMap context, ByteBuffer buffer) { return new ProxyToServerConnection(context, buffer); } @@ -379,7 +379,7 @@ public class ConnectHandler extends HandlerWrapper * or -1 if the channel has been closed remotely * @throws IOException if the endPoint cannot be read */ - protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap context) throws IOException + protected int read(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap context) throws IOException { return endPoint.fill(buffer); } @@ -393,7 +393,7 @@ public class ConnectHandler extends HandlerWrapper * @throws IOException if the buffer cannot be written * @return the number of bytes written */ - protected int write(EndPoint endPoint, Buffer buffer, ConcurrentMap context) throws IOException + protected int write(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap context) throws IOException { if (buffer == null) return 0; @@ -469,14 +469,14 @@ public class ConnectHandler extends HandlerWrapper public class ProxyToServerConnection implements AsyncConnection { private final CountDownLatch _ready = new CountDownLatch(1); - private final Buffer _buffer = new IndirectNIOBuffer(1024); + private final ByteBuffer _buffer = new IndirectNIOBuffer(1024); private final ConcurrentMap _context; - private volatile Buffer _data; + private volatile ByteBuffer _data; private volatile ClientToProxyConnection _toClient; private volatile long _timestamp; private volatile AsyncEndPoint _endPoint; - public ProxyToServerConnection(ConcurrentMap context, Buffer data) + public ProxyToServerConnection(ConcurrentMap context, ByteBuffer data) { _context = context; _data = data; @@ -683,7 +683,7 @@ public class ConnectHandler extends HandlerWrapper public class ClientToProxyConnection implements AsyncConnection { - private final Buffer _buffer = new IndirectNIOBuffer(1024); + private final ByteBuffer _buffer = new IndirectNIOBuffer(1024); private final ConcurrentMap _context; private final SocketChannel _channel; private final EndPoint _endPoint; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index 812ef3013aa..74bd4aefc69 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -57,7 +57,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpException; import org.eclipse.jetty.http.MimeTypes; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.server.AbstractHttpConnection; import org.eclipse.jetty.server.Dispatcher; import org.eclipse.jetty.server.Handler; @@ -1745,7 +1745,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server. { if (_mimeTypes == null) return null; - Buffer mime = _mimeTypes.getMimeByExtension(file); + ByteBuffer mime = _mimeTypes.getMimeByExtension(file); if (mime != null) return mime.toString(); return null; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java index dba7f5bd117..9af6f1a81e0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java @@ -21,8 +21,8 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; @@ -86,24 +86,24 @@ public class DefaultHandler extends AbstractHandler String method=request.getMethod(); // little cheat for common request - if (_serveIcon && _favicon!=null && method.equals(HttpMethods.GET) && request.getRequestURI().equals("/favicon.ico")) + if (_serveIcon && _favicon!=null && method.equals(HttpMethod.GET) && request.getRequestURI().equals("/favicon.ico")) { - if (request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE)==_faviconModified) + if (request.getDateHeader(HttpHeader.IF_MODIFIED_SINCE)==_faviconModified) response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); else { response.setStatus(HttpServletResponse.SC_OK); response.setContentType("image/x-icon"); response.setContentLength(_favicon.length); - response.setDateHeader(HttpHeaders.LAST_MODIFIED, _faviconModified); - response.setHeader(HttpHeaders.CACHE_CONTROL,"max-age=360000,public"); + response.setDateHeader(HttpHeader.LAST_MODIFIED, _faviconModified); + response.setHeader(HttpHeader.CACHE_CONTROL,"max-age=360000,public"); response.getOutputStream().write(_favicon); } return; } - if (!method.equals(HttpMethods.GET) || !request.getRequestURI().equals("/")) + if (!method.equals(HttpMethod.GET) || !request.getRequestURI().equals("/")) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java index b43e34b9cef..4f0d3616a53 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java @@ -19,8 +19,8 @@ import java.io.Writer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.AbstractHttpConnection; @@ -48,11 +48,11 @@ public class ErrorHandler extends AbstractHandler AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection(); connection.getRequest().setHandled(true); String method = request.getMethod(); - if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST) && !method.equals(HttpMethods.HEAD)) + if(!method.equals(HttpMethod.GET) && !method.equals(HttpMethod.POST) && !method.equals(HttpMethod.HEAD)) return; response.setContentType(MimeTypes.TEXT_HTML_8859_1); if (_cacheControl!=null) - response.setHeader(HttpHeaders.CACHE_CONTROL, _cacheControl); + response.setHeader(HttpHeader.CACHE_CONTROL, _cacheControl); ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(4096); handleErrorPage(request, writer, connection.getResponse().getStatus(), connection.getResponse().getReason()); writer.flush(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GzipHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GzipHandler.java index 81198f5299d..d2245679ec0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GzipHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GzipHandler.java @@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.continuation.ContinuationSupport; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.gzip.GzipResponseWrapper; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.util.log.Log; @@ -210,7 +210,7 @@ public class GzipHandler extends HandlerWrapper { String ae = request.getHeader("accept-encoding"); if (ae != null && ae.indexOf("gzip")>=0 && !response.containsHeader("Content-Encoding") - && !HttpMethods.HEAD.equalsIgnoreCase(request.getMethod())) + && !HttpMethod.HEAD.equalsIgnoreCase(request.getMethod())) { if (_excluded!=null) { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/MovedContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/MovedContextHandler.java index 6ff990c9c04..fc78b58508d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/MovedContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/MovedContextHandler.java @@ -19,7 +19,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.server.HandlerContainer; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.util.URIUtil; @@ -116,10 +116,10 @@ public class MovedContextHandler extends ContextHandler location.append(q); } - response.setHeader(HttpHeaders.LOCATION,location.toString()); + response.setHeader(HttpHeader.LOCATION,location.toString()); if (_expires!=null) - response.setHeader(HttpHeaders.EXPIRES,_expires); + response.setHeader(HttpHeader.EXPIRES,_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java index f4978c67494..9a0646a6013 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java @@ -22,11 +22,11 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpFields; -import org.eclipse.jetty.http.HttpHeaders; -import org.eclipse.jetty.http.HttpMethods; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.MimeTypes; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.WriterOutputStream; import org.eclipse.jetty.server.AbstractHttpConnection; @@ -354,9 +354,9 @@ public class ResourceHandler extends HandlerWrapper boolean skipContentBody = false; - if(!HttpMethods.GET.equals(request.getMethod())) + if(!HttpMethod.GET.equals(request.getMethod())) { - if(!HttpMethods.HEAD.equals(request.getMethod())) + if(!HttpMethod.HEAD.equals(request.getMethod())) { //try another handler super.handle(target, baseRequest, request, response); @@ -416,7 +416,7 @@ public class ResourceHandler extends HandlerWrapper long last_modified=resource.lastModified(); if (last_modified>0) { - long if_modified=request.getDateHeader(HttpHeaders.IF_MODIFIED_SINCE); + long if_modified=request.getDateHeader(HttpHeader.IF_MODIFIED_SINCE); if (if_modified>0 && last_modified/1000<=if_modified/1000) { response.setStatus(HttpStatus.NOT_MODIFIED_304); @@ -424,13 +424,13 @@ public class ResourceHandler extends HandlerWrapper } } - Buffer mime=_mimeTypes.getMimeByExtension(resource.toString()); + ByteBuffer mime=_mimeTypes.getMimeByExtension(resource.toString()); if (mime==null) mime=_mimeTypes.getMimeByExtension(request.getPathInfo()); // set the headers doResponseHeaders(response,resource,mime!=null?mime.toString():null); - response.setDateHeader(HttpHeaders.LAST_MODIFIED,last_modified); + response.setDateHeader(HttpHeader.LAST_MODIFIED,last_modified); if(skipContentBody) return; // Send the content @@ -485,18 +485,18 @@ public class ResourceHandler extends HandlerWrapper HttpFields fields = ((Response)response).getHttpFields(); if (length>0) - fields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER,length); + fields.putLongField(HttpHeader.CONTENT_LENGTH_BUFFER,length); if (_cacheControl!=null) - fields.put(HttpHeaders.CACHE_CONTROL_BUFFER,_cacheControl); + fields.put(HttpHeader.CACHE_CONTROL_BUFFER,_cacheControl); } else { if (length>0) - response.setHeader(HttpHeaders.CONTENT_LENGTH,Long.toString(length)); + response.setHeader(HttpHeader.CONTENT_LENGTH,Long.toString(length)); if (_cacheControl!=null) - response.setHeader(HttpHeaders.CACHE_CONTROL,_cacheControl.toString()); + response.setHeader(HttpHeader.CACHE_CONTROL,_cacheControl.toString()); } } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java index 8e331142e6a..12b880edc94 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java @@ -23,7 +23,7 @@ import java.nio.channels.SocketChannel; import java.util.Set; import org.eclipse.jetty.http.HttpException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ConnectedEndPoint; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -228,10 +228,10 @@ public class BlockingChannelConnector extends AbstractNIOConnector /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.io.nio.ChannelEndPoint#fill(org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.io.nio.ChannelEndPoint#fill(org.eclipse.jetty.io.ByteBuffer) */ @Override - public int fill(Buffer buffer) throws IOException + public int fill(ByteBuffer buffer) throws IOException { _idleTimestamp=System.currentTimeMillis(); return super.fill(buffer); @@ -239,10 +239,10 @@ public class BlockingChannelConnector extends AbstractNIOConnector /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.io.nio.ChannelEndPoint#flush(org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.io.nio.ChannelEndPoint#flush(org.eclipse.jetty.io.ByteBuffer) */ @Override - public int flush(Buffer buffer) throws IOException + public int flush(ByteBuffer buffer) throws IOException { _idleTimestamp=System.currentTimeMillis(); return super.flush(buffer); @@ -250,10 +250,10 @@ public class BlockingChannelConnector extends AbstractNIOConnector /* ------------------------------------------------------------ */ /** - * @see org.eclipse.jetty.io.nio.ChannelEndPoint#flush(org.eclipse.jetty.io.Buffer, org.eclipse.jetty.io.Buffer, org.eclipse.jetty.io.Buffer) + * @see org.eclipse.jetty.io.nio.ChannelEndPoint#flush(org.eclipse.jetty.io.ByteBuffer, org.eclipse.jetty.io.ByteBuffer, org.eclipse.jetty.io.ByteBuffer) */ @Override - public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException + public int flush(ByteBuffer header, ByteBuffer buffer, ByteBuffer trailer) throws IOException { _idleTimestamp=System.currentTimeMillis(); return super.flush(header,buffer,trailer); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslCertificates.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslCertificates.java index 7fcd9f8d111..1e7fb25f5f6 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslCertificates.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslCertificates.java @@ -8,7 +8,7 @@ import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.bio.SocketEndPoint; import org.eclipse.jetty.server.Request; @@ -86,7 +86,7 @@ public class SslCertificates */ public static void customize(SSLSession sslSession, EndPoint endpoint, Request request) throws IOException { - request.setScheme(HttpSchemes.HTTPS); + request.setScheme(HttpScheme.HTTPS); try { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java index de82d510de1..89d5e1d60d3 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSelectChannelConnector.java @@ -21,7 +21,7 @@ import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.io.AsyncEndPoint; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Buffers.Type; @@ -97,7 +97,7 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements @Override public void customize(EndPoint endpoint, Request request) throws IOException { - request.setScheme(HttpSchemes.HTTPS); + request.setScheme(HttpScheme.HTTPS); super.customize(endpoint,request); SslConnection.SslEndPoint sslEndpoint=(SslConnection.SslEndPoint)endpoint; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSocketConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSocketConnector.java index f18981cce7b..4dda3f7ec2d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSocketConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ssl/SslSocketConnector.java @@ -25,7 +25,7 @@ import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; -import org.eclipse.jetty.http.HttpSchemes; +import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.io.bio.SocketEndPoint; @@ -140,7 +140,7 @@ public class SslSocketConnector extends SocketConnector implements SslConnector throws IOException { super.customize(endpoint, request); - request.setScheme(HttpSchemes.HTTPS); + request.setScheme(HttpScheme.HTTPS); SocketEndPoint socket_end_point = (SocketEndPoint)endpoint; SSLSocket sslSocket = (SSLSocket)socket_end_point.getTransport(); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java b/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java index 301c352899a..7e9f938438b 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java @@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationSupport; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.util.StringUtil; @@ -93,7 +93,7 @@ public class DumpHandler extends AbstractHandler } baseRequest.setHandled(true); - response.setHeader(HttpHeaders.CONTENT_TYPE,MimeTypes.TEXT_HTML); + response.setHeader(HttpHeader.CONTENT_TYPE,MimeTypes.TEXT_HTML); OutputStream out = response.getOutputStream(); ByteArrayOutputStream buf = new ByteArrayOutputStream(2048); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java index 1e258f33a9b..695580af879 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java @@ -29,7 +29,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -443,7 +443,7 @@ public class HttpConnectionTest try { baseRequest.setHandled(true); - response.setHeader(HttpHeaders.CONTENT_TYPE,MimeTypes.TEXT_HTML); + response.setHeader(HttpHeader.CONTENT_TYPE,MimeTypes.TEXT_HTML); response.setHeader("LongStr", longstr); PrintWriter writer = response.getWriter(); writer.write("

    FOO

    "); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java index 3d21c413757..d77d0c81225 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpWriterTest.java @@ -8,7 +8,7 @@ import java.io.IOException; import org.eclipse.jetty.http.AbstractGenerator; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpGenerator; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; @@ -63,7 +63,7 @@ public class HttpWriterTest return 1024; } - public void addContent(Buffer content, boolean last) throws IOException + public void addContent(ByteBuffer content, boolean last) throws IOException { _bytes.put(content); content.clear(); @@ -160,8 +160,8 @@ public class HttpWriterTest @Test public void testOutput() throws Exception { - Buffer sb=new ByteArrayBuffer(1500); - Buffer bb=new ByteArrayBuffer(8096); + ByteBuffer sb=new ByteArrayBuffer(1500); + ByteBuffer bb=new ByteArrayBuffer(8096); HttpFields fields = new HttpFields(); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/NetworkTrafficListenerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/NetworkTrafficListenerTest.java index 56e8e66b68b..4afb9cf8bd4 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/NetworkTrafficListenerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/NetworkTrafficListenerTest.java @@ -30,7 +30,7 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.NetworkTrafficListener; import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.nio.NetworkTrafficSelectChannelConnector; @@ -119,14 +119,14 @@ public class NetworkTrafficListenerTest connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty() { @Override - public void incoming(Socket socket, Buffer bytes) + public void incoming(Socket socket, ByteBuffer bytes) { incomingData.set(bytes.toString("UTF-8")); incomingLatch.countDown(); } @Override - public void outgoing(Socket socket, Buffer bytes) + public void outgoing(Socket socket, ByteBuffer bytes) { outgoingData.set(outgoingData.get() + bytes.toString("UTF-8")); outgoingLatch.countDown(); @@ -183,13 +183,13 @@ public class NetworkTrafficListenerTest final CountDownLatch outgoingLatch = new CountDownLatch(2); connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty() { - public void incoming(Socket socket, Buffer bytes) + public void incoming(Socket socket, ByteBuffer bytes) { incomingData.set(bytes.toString("UTF-8")); incomingLatch.countDown(); } - public void outgoing(Socket socket, Buffer bytes) + public void outgoing(Socket socket, ByteBuffer bytes) { outgoingData.set(outgoingData.get() + bytes.toString("UTF-8")); outgoingLatch.countDown(); @@ -250,13 +250,13 @@ public class NetworkTrafficListenerTest final CountDownLatch outgoingLatch = new CountDownLatch(4); connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty() { - public void incoming(Socket socket, Buffer bytes) + public void incoming(Socket socket, ByteBuffer bytes) { incomingData.set(bytes.toString("UTF-8")); incomingLatch.countDown(); } - public void outgoing(Socket socket, Buffer bytes) + public void outgoing(Socket socket, ByteBuffer bytes) { outgoingData.set(outgoingData.get() + bytes.toString("UTF-8")); outgoingLatch.countDown(); @@ -316,13 +316,13 @@ public class NetworkTrafficListenerTest final CountDownLatch outgoingLatch = new CountDownLatch(1); connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty() { - public void incoming(Socket socket, Buffer bytes) + public void incoming(Socket socket, ByteBuffer bytes) { incomingData.set(bytes.toString("UTF-8")); incomingLatch.countDown(); } - public void outgoing(Socket socket, Buffer bytes) + public void outgoing(Socket socket, ByteBuffer bytes) { outgoingData.set(outgoingData.get() + bytes.toString("UTF-8")); outgoingLatch.countDown(); @@ -389,12 +389,12 @@ public class NetworkTrafficListenerTest final CountDownLatch outgoingLatch = new CountDownLatch(1); connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty() { - public void incoming(Socket socket, Buffer bytes) + public void incoming(Socket socket, ByteBuffer bytes) { incomingData.set(incomingData.get() + bytes.toString("UTF-8")); } - public void outgoing(Socket socket, Buffer bytes) + public void outgoing(Socket socket, ByteBuffer bytes) { outgoingData.set(outgoingData.get() + bytes.toString("UTF-8")); outgoingLatch.countDown(); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java index 497e081dd00..fd5f6be2e1b 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java @@ -36,7 +36,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSessionContext; import org.eclipse.jetty.http.Generator; -import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http.Parser; import org.eclipse.jetty.io.ByteArrayBuffer; @@ -314,7 +314,7 @@ public class ResponseTest response.sendError(500, "Database Error"); assertEquals(500, response.getStatus()); assertEquals("Database Error", response.getReason()); - assertEquals("must-revalidate,no-cache,no-store", response.getHeader(HttpHeaders.CACHE_CONTROL)); + assertEquals("must-revalidate,no-cache,no-store", response.getHeader(HttpHeader.CACHE_CONTROL)); response=newResponse(); @@ -327,7 +327,7 @@ public class ResponseTest response.sendError(406, "Super Nanny"); assertEquals(406, response.getStatus()); assertEquals("Super Nanny", response.getReason()); - assertEquals("must-revalidate,no-cache,no-store", response.getHeader(HttpHeaders.CACHE_CONTROL)); + assertEquals("must-revalidate,no-cache,no-store", response.getHeader(HttpHeader.CACHE_CONTROL)); } @Test diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerTest.java index 9abd7b3683c..e390c242fed 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ConnectHandlerTest.java @@ -18,7 +18,7 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.nio.SelectChannelConnector; @@ -430,14 +430,14 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest } @Override - protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap context) throws IOException + protected int read(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap context) throws IOException { assertEquals(contextValue, context.get(contextKey)); return super.read(endPoint, buffer, context); } @Override - protected int write(EndPoint endPoint, Buffer buffer, ConcurrentMap context) throws IOException + protected int write(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap context) throws IOException { assertEquals(contextValue, context.get(contextKey)); return super.write(endPoint, buffer, context); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/StringMap.java b/jetty-util/src/main/java/org/eclipse/jetty/util/StringMap.java index 61909882e57..29a54ff8924 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/StringMap.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/StringMap.java @@ -60,7 +60,7 @@ public class StringMap extends AbstractMap public StringMap(final boolean ignoreCase) { _caseInsensitive=ignoreCase; - _map = new TreeMap<>(new Comparator() + _map = new TreeMap(new Comparator() { @Override public int compare(Object o1, Object o2) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/AbstractExtension.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/AbstractExtension.java index 0e2aff4dcc6..a0084d69ecf 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/AbstractExtension.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/AbstractExtension.java @@ -19,7 +19,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.websocket.WebSocketParser.FrameHandler; @@ -90,7 +90,7 @@ public class AbstractExtension implements Extension return name.toString(); } - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { // System.err.printf("onFrame %s %x %x %d\n",getExtensionName(),flags,opcode,buffer.length()); _inbound.onFrame(flags,opcode,buffer); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/DeflateFrameExtension.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/DeflateFrameExtension.java index 91bbf275f40..25f3c67abc0 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/DeflateFrameExtension.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/DeflateFrameExtension.java @@ -21,7 +21,7 @@ import java.util.zip.DataFormatException; import java.util.zip.Deflater; import java.util.zip.Inflater; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -63,7 +63,7 @@ public class DeflateFrameExtension extends AbstractExtension * @see org.eclipse.jetty.websocket.AbstractExtension#onFrame(byte, byte, org.eclipse.jetty.io.Buffer) */ @Override - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { if (getConnection().isControl(opcode) || !isFlag(flags,1)) { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketBuffers.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketBuffers.java index d016e67cdb6..c6ab98c98f7 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketBuffers.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketBuffers.java @@ -28,7 +28,7 @@ package org.eclipse.jetty.websocket; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.Buffers.Type; import org.eclipse.jetty.io.BuffersFactory; @@ -53,17 +53,17 @@ public class WebSocketBuffers _buffers = BuffersFactory.newBuffers(Type.DIRECT,bufferSize,Type.INDIRECT,bufferSize,Type.INDIRECT,-1); } - public Buffer getBuffer() + public ByteBuffer getBuffer() { return _buffers.getBuffer(); } - public Buffer getDirectBuffer() + public ByteBuffer getDirectBuffer() { return _buffers.getHeader(); } - public void returnBuffer(Buffer buffer) + public void returnBuffer(ByteBuffer buffer) { _buffers.returnBuffer(buffer); } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 3fd58535b35..61b9777916b 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -31,7 +31,7 @@ import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpParser; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ConnectedEndPoint; @@ -370,7 +370,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle _parser = new HttpParser(buffers, _endp, new HttpParser.EventHandler() { @Override - public void startResponse(Buffer version, int status, Buffer reason) throws IOException + public void startResponse(ByteBuffer version, int status, ByteBuffer reason) throws IOException { if (status != 101) { @@ -380,14 +380,14 @@ public class WebSocketClientFactory extends AggregateLifeCycle } @Override - public void parsedHeader(Buffer name, Buffer value) throws IOException + public void parsedHeader(ByteBuffer name, ByteBuffer value) throws IOException { if (__ACCEPT.equals(name)) _accept = value.toString(); } @Override - public void startRequest(Buffer method, Buffer url, Buffer version) throws IOException + public void startRequest(ByteBuffer method, ByteBuffer url, ByteBuffer version) throws IOException { if (_error == null) _error = "Bad response: " + method + " " + url + " " + version; @@ -395,7 +395,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle } @Override - public void content(Buffer ref) throws IOException + public void content(ByteBuffer ref) throws IOException { if (_error == null) _error = "Bad response. " + ref.length() + "B of content?"; @@ -495,7 +495,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle { WebSocketConnection connection = newWebSocketConnection(); - Buffer header = _parser.getHeaderBuffer(); + ByteBuffer header = _parser.getHeaderBuffer(); if (header.hasContent()) connection.fillBuffersFrom(header); _buffers.returnBuffer(header); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java index 67bfb37e651..b6ccb6e37f5 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java @@ -18,12 +18,12 @@ package org.eclipse.jetty.websocket; import java.util.List; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.nio.AsyncConnection; public interface WebSocketConnection extends AsyncConnection { - void fillBuffersFrom(Buffer buffer); + void fillBuffersFrom(ByteBuffer buffer); List getExtensions(); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java index 12ec1101444..0eada02fff1 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD00.java @@ -36,7 +36,7 @@ import java.util.List; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -100,7 +100,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc { // take any available bytes from the parser buffer, which may have already been read - Buffer buffer=_parser.getBuffer(); + ByteBuffer buffer=_parser.getBuffer(); if (buffer!=null && buffer.length()>0) { int l=buffer.length(); @@ -299,7 +299,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc } /* ------------------------------------------------------------ */ - public void fillBuffersFrom(Buffer buffer) + public void fillBuffersFrom(ByteBuffer buffer) { _parser.fill(buffer); } @@ -417,7 +417,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc _websocket=websocket; } - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { try { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java index c7c5f2b0a76..06a1661eff7 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD06.java @@ -36,7 +36,7 @@ import java.util.List; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -282,7 +282,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc } /* ------------------------------------------------------------ */ - public void fillBuffersFrom(Buffer buffer) + public void fillBuffersFrom(ByteBuffer buffer) { _parser.fill(buffer); } @@ -537,7 +537,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc private ByteArrayBuffer _aggregate; private byte _opcode=-1; - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { boolean lastFrame = isLastFrame(flags); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java index 9b282d6f6da..984aaec7fd8 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionD08.java @@ -36,7 +36,7 @@ import java.util.List; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -378,7 +378,7 @@ public class WebSocketConnectionD08 extends AbstractConnection implements WebSoc } /* ------------------------------------------------------------ */ - public void fillBuffersFrom(Buffer buffer) + public void fillBuffersFrom(ByteBuffer buffer) { _parser.fill(buffer); } @@ -624,7 +624,7 @@ public class WebSocketConnectionD08 extends AbstractConnection implements WebSoc private ByteArrayBuffer _aggregate; private byte _opcode=-1; - public void onFrame(final byte flags, final byte opcode, final Buffer buffer) + public void onFrame(final byte flags, final byte opcode, final ByteBuffer buffer) { boolean lastFrame = isLastFrame(flags); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java index 9a6377bd125..af5df4758b6 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java @@ -36,7 +36,7 @@ import java.util.List; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -408,7 +408,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We } /* ------------------------------------------------------------ */ - public void fillBuffersFrom(Buffer buffer) + public void fillBuffersFrom(ByteBuffer buffer) { _parser.fill(buffer); } @@ -662,7 +662,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We private ByteArrayBuffer _aggregate; private byte _opcode=-1; - public void onFrame(final byte flags, final byte opcode, final Buffer buffer) + public void onFrame(final byte flags, final byte opcode, final ByteBuffer buffer) { boolean lastFrame = isLastFrame(flags); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD00.java index 3e683d2803f..237dd8b52e1 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD00.java @@ -31,7 +31,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; import java.math.BigInteger; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; @@ -47,7 +47,7 @@ public class WebSocketGeneratorD00 implements WebSocketGenerator { final private WebSocketBuffers _buffers; final private EndPoint _endp; - private Buffer _buffer; + private ByteBuffer _buffer; public WebSocketGeneratorD00(WebSocketBuffers buffers, EndPoint endp) { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD06.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD06.java index 88a05f061cc..fd60ee1aa65 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD06.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD06.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; @@ -46,7 +46,7 @@ public class WebSocketGeneratorD06 implements WebSocketGenerator { final private WebSocketBuffers _buffers; final private EndPoint _endp; - private Buffer _buffer; + private ByteBuffer _buffer; private final byte[] _mask=new byte[4]; private int _m; private boolean _opsent; diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD08.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD08.java index 4c11c142209..702eee1161d 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD08.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorD08.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; @@ -46,7 +46,7 @@ public class WebSocketGeneratorD08 implements WebSocketGenerator { final private WebSocketBuffers _buffers; final private EndPoint _endp; - private Buffer _buffer; + private ByteBuffer _buffer; private final byte[] _mask=new byte[4]; private int _m; private boolean _opsent; @@ -66,7 +66,7 @@ public class WebSocketGeneratorD08 implements WebSocketGenerator _maskGen=maskGen; } - public synchronized Buffer getBuffer() + public synchronized ByteBuffer getBuffer() { return _buffer; } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorRFC6455.java index 9b214d95bac..39ffcb2dc10 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketGeneratorRFC6455.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; @@ -46,7 +46,7 @@ public class WebSocketGeneratorRFC6455 implements WebSocketGenerator { final private WebSocketBuffers _buffers; final private EndPoint _endp; - private Buffer _buffer; + private ByteBuffer _buffer; private final byte[] _mask=new byte[4]; private int _m; private boolean _opsent; @@ -67,7 +67,7 @@ public class WebSocketGeneratorRFC6455 implements WebSocketGenerator _maskGen=maskGen; } - public synchronized Buffer getBuffer() + public synchronized ByteBuffer getBuffer() { return _buffer; } @@ -261,7 +261,7 @@ public class WebSocketGeneratorRFC6455 implements WebSocketGenerator // Do NOT use synchronized (this) // because it's very easy to deadlock when debugging is enabled. // We do a best effort to print the right toString() and that's it. - Buffer buffer = _buffer; + ByteBuffer buffer = _buffer; return String.format("%s@%x closed=%b buffer=%d", getClass().getSimpleName(), hashCode(), diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParser.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParser.java index b36c2ba9186..7bc4319c3b7 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParser.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParser.java @@ -28,7 +28,7 @@ package org.eclipse.jetty.websocket; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; @@ -45,11 +45,11 @@ public interface WebSocketParser /* ------------------------------------------------------------ */ public interface FrameHandler { - void onFrame(byte flags, byte opcode, Buffer buffer); + void onFrame(byte flags, byte opcode, ByteBuffer buffer); void close(int code,String message); } - Buffer getBuffer(); + ByteBuffer getBuffer(); /** * @return an indication of progress, normally bytes filled plus events parsed, or -1 for EOF @@ -58,6 +58,6 @@ public interface WebSocketParser boolean isBufferEmpty(); - void fill(Buffer buffer); + void fill(ByteBuffer buffer); } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD00.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD00.java index 190ccde210b..c7f3ebdeb48 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD00.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD00.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.TypeUtil; @@ -58,7 +58,7 @@ public class WebSocketParserD00 implements WebSocketParser private final EndPoint _endp; private final FrameHandler _handler; private int _state; - private Buffer _buffer; + private ByteBuffer _buffer; private byte _opcode; private int _length; @@ -84,7 +84,7 @@ public class WebSocketParserD00 implements WebSocketParser } /* ------------------------------------------------------------ */ - public Buffer getBuffer() + public ByteBuffer getBuffer() { return _buffer; } @@ -189,7 +189,7 @@ public class WebSocketParserD00 implements WebSocketParser if (_buffer.markIndex()<0) if (_buffer.length()<_length) break charloop; - Buffer data=_buffer.sliceFromMark(_length); + ByteBuffer data=_buffer.sliceFromMark(_length); _buffer.skip(_length); _state=STATE_START; progress++; @@ -208,7 +208,7 @@ public class WebSocketParserD00 implements WebSocketParser } /* ------------------------------------------------------------ */ - public void fill(Buffer buffer) + public void fill(ByteBuffer buffer) { if (buffer!=null && buffer.length()>0) { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD06.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD06.java index 4c6d29016aa..26cc6969537 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD06.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD06.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.log.Log; @@ -70,7 +70,7 @@ public class WebSocketParserD06 implements WebSocketParser private final FrameHandler _handler; private final boolean _masked; private State _state; - private Buffer _buffer; + private ByteBuffer _buffer; private byte _flags; private byte _opcode; private int _bytesNeeded; @@ -103,7 +103,7 @@ public class WebSocketParserD06 implements WebSocketParser } /* ------------------------------------------------------------ */ - public Buffer getBuffer() + public ByteBuffer getBuffer() { return _buffer; } @@ -277,7 +277,7 @@ public class WebSocketParserD06 implements WebSocketParser if (_state==State.DATA && available>=_bytesNeeded) { - Buffer data =_buffer.get(_bytesNeeded); + ByteBuffer data =_buffer.get(_bytesNeeded); if (_masked) { if (data.array()==null) @@ -306,7 +306,7 @@ public class WebSocketParserD06 implements WebSocketParser } /* ------------------------------------------------------------ */ - public void fill(Buffer buffer) + public void fill(ByteBuffer buffer) { if (buffer!=null && buffer.length()>0) { diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD08.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD08.java index 8101e02f9f6..b2cb7ad4a7c 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD08.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD08.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.log.Log; @@ -69,7 +69,7 @@ public class WebSocketParserD08 implements WebSocketParser private final FrameHandler _handler; private final boolean _shouldBeMasked; private State _state; - private Buffer _buffer; + private ByteBuffer _buffer; private byte _flags; private byte _opcode; private int _bytesNeeded; @@ -123,7 +123,7 @@ public class WebSocketParserD08 implements WebSocketParser } /* ------------------------------------------------------------ */ - public Buffer getBuffer() + public ByteBuffer getBuffer() { return _buffer; } @@ -160,7 +160,7 @@ public class WebSocketParserD08 implements WebSocketParser // Can we send a fake frame? if (_fakeFragments && _state==State.DATA) { - Buffer data =_buffer.get(4*(available/4)); + ByteBuffer data =_buffer.get(4*(available/4)); _buffer.compact(); if (_masked) { @@ -331,7 +331,7 @@ public class WebSocketParserD08 implements WebSocketParser } else { - Buffer data =_buffer.get(_bytesNeeded); + ByteBuffer data =_buffer.get(_bytesNeeded); if (_masked) { if (data.array()==null) @@ -355,7 +355,7 @@ public class WebSocketParserD08 implements WebSocketParser } /* ------------------------------------------------------------ */ - public void fill(Buffer buffer) + public void fill(ByteBuffer buffer) { if (buffer!=null && buffer.length()>0) { @@ -381,7 +381,7 @@ public class WebSocketParserD08 implements WebSocketParser @Override public String toString() { - Buffer buffer=_buffer; + ByteBuffer buffer=_buffer; return WebSocketParserD08.class.getSimpleName()+"@"+ Integer.toHexString(hashCode())+"|"+_state+"|"+(buffer==null?"<>":buffer.toDetailString()); } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java index dbb16cb4390..cedf8214a03 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java @@ -30,7 +30,7 @@ package org.eclipse.jetty.websocket; import java.io.IOException; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.Buffers; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.log.Log; @@ -69,7 +69,7 @@ public class WebSocketParserRFC6455 implements WebSocketParser private final FrameHandler _handler; private final boolean _shouldBeMasked; private State _state; - private Buffer _buffer; + private ByteBuffer _buffer; private byte _flags; private byte _opcode; private int _bytesNeeded; @@ -123,7 +123,7 @@ public class WebSocketParserRFC6455 implements WebSocketParser } /* ------------------------------------------------------------ */ - public Buffer getBuffer() + public ByteBuffer getBuffer() { return _buffer; } @@ -161,7 +161,7 @@ public class WebSocketParserRFC6455 implements WebSocketParser // Can we send a fake frame? if (_fragmentFrames && _state==State.DATA) { - Buffer data =_buffer.get(4*(available/4)); + ByteBuffer data =_buffer.get(4*(available/4)); _buffer.compact(); if (_masked) { @@ -342,7 +342,7 @@ public class WebSocketParserRFC6455 implements WebSocketParser } else { - Buffer data =_buffer.get(_bytesNeeded); + ByteBuffer data =_buffer.get(_bytesNeeded); if (_masked) { if (data.array()==null) @@ -369,7 +369,7 @@ public class WebSocketParserRFC6455 implements WebSocketParser } /* ------------------------------------------------------------ */ - public void fill(Buffer buffer) + public void fill(ByteBuffer buffer) { if (buffer!=null && buffer.length()>0) { diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java index 781a8b64926..587203a3927 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD08Test.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletRequest; import junit.framework.Assert; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.bio.SocketEndPoint; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -158,7 +158,7 @@ public class WebSocketLoadD08Test private final WebSocketParserD08 _parser; private final WebSocketParser.FrameHandler _handler = new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { _response=buffer; } @@ -167,7 +167,7 @@ public class WebSocketLoadD08Test { } }; - private volatile Buffer _response; + private volatile ByteBuffer _response; public WebSocketClient(String host, int port, int readTimeout, CountDownLatch latch, int iterations) throws IOException { diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java index 13a3869bdc1..bfa7018fcee 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java @@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; import junit.framework.Assert; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.bio.SocketEndPoint; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -156,7 +156,7 @@ public class WebSocketLoadRFC6455Test private final WebSocketParserRFC6455 _parser; private final WebSocketParser.FrameHandler _handler = new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { _response=buffer; } @@ -165,7 +165,7 @@ public class WebSocketLoadRFC6455Test { } }; - private volatile Buffer _response; + private volatile ByteBuffer _response; public WebSocketClient(String host, int port, int readTimeout, CountDownLatch latch, int iterations) throws IOException { diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java index 5952f8f4df7..e8039f113d7 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD06Test.java @@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicReference; import javax.servlet.http.HttpServletRequest; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -649,7 +649,7 @@ public class WebSocketMessageD06Test WebSocketParserD06 parser = new WebSocketParserD06(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { received.set(buffer.toString()); } @@ -682,7 +682,7 @@ public class WebSocketMessageD06Test WebSocketParserD06 parser = new WebSocketParserD06(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { received.set(buffer.toString()); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java index be553c2441b..dde659d19e0 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageD08Test.java @@ -32,7 +32,7 @@ import java.util.zip.Inflater; import javax.servlet.http.HttpServletRequest; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -1092,7 +1092,7 @@ public class WebSocketMessageD08Test WebSocketParserD08 parser = new WebSocketParserD08(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { received.set(buffer.toString()); } @@ -1125,7 +1125,7 @@ public class WebSocketMessageD08Test WebSocketParserD08 parser = new WebSocketParserD08(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { received.set(buffer.toString()); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java index 175ef6bf014..2472da3a206 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java @@ -34,7 +34,7 @@ import java.util.zip.Inflater; import javax.servlet.http.HttpServletRequest; -import org.eclipse.jetty.io.Buffer; +import org.eclipse.jetty.io.ByteBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -1439,7 +1439,7 @@ public class WebSocketMessageRFC6455Test WebSocketParserRFC6455 parser = new WebSocketParserRFC6455(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { received.set(buffer.toString()); } @@ -1472,7 +1472,7 @@ public class WebSocketMessageRFC6455Test WebSocketParserRFC6455 parser = new WebSocketParserRFC6455(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { received.set(buffer.toString()); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java index 7e38a9b71ff..bab262947f9 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD00Test.java @@ -21,9 +21,9 @@ import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferCache.CachedBuffer; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.io.ByteBuffer; +import org.eclipse.jetty.io.BufferCache.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.util.StringUtil; @@ -50,7 +50,7 @@ public class WebSocketParserD00Test @Test public void testCache() throws Exception { - assertEquals(HttpHeaderValues.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValues.CACHE.lookup("Upgrade")).getOrdinal()); + assertEquals(HttpHeaderValue.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValue.CACHE.lookup("Upgrade")).getOrdinal()); } @Test @@ -144,7 +144,7 @@ public class WebSocketParserD00Test { public List _data = new ArrayList(); - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { _data.add(buffer.toString(StringUtil.__UTF8)); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD06Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD06Test.java index 27b0182b955..dbd807a6893 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD06Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD06Test.java @@ -20,9 +20,9 @@ import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferCache.CachedBuffer; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.io.ByteBuffer; +import org.eclipse.jetty.io.BufferCache.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.util.StringUtil; @@ -54,7 +54,7 @@ public class WebSocketParserD06Test } @Override - public int put(Buffer src) + public int put(ByteBuffer src) { return put(src.asArray(),0,src.length()); } @@ -102,7 +102,7 @@ public class WebSocketParserD06Test @Test public void testCache() throws Exception { - assertEquals(HttpHeaderValues.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValues.CACHE.lookup("Upgrade")).getOrdinal()); + assertEquals(HttpHeaderValue.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValue.CACHE.lookup("Upgrade")).getOrdinal()); } @Test @@ -302,7 +302,7 @@ public class WebSocketParserD06Test int _code; String _message; - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { _flags=flags; _opcode=opcode; diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD08Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD08Test.java index fa156eac4f8..a71df1bfb96 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD08Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserD08Test.java @@ -20,9 +20,9 @@ import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferCache.CachedBuffer; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.io.ByteBuffer; +import org.eclipse.jetty.io.BufferCache.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.util.StringUtil; @@ -53,7 +53,7 @@ public class WebSocketParserD08Test } @Override - public int put(Buffer src) + public int put(ByteBuffer src) { return put(src.asArray(),0,src.length()); } @@ -107,7 +107,7 @@ public class WebSocketParserD08Test @Test public void testCache() throws Exception { - assertEquals(HttpHeaderValues.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValues.CACHE.lookup("Upgrade")).getOrdinal()); + assertEquals(HttpHeaderValue.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValue.CACHE.lookup("Upgrade")).getOrdinal()); } @Test @@ -343,7 +343,7 @@ public class WebSocketParserD08Test String _message; int _frames; - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { _frames++; _flags=flags; diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java index 5d9e920dd76..f2e7d6045dc 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java @@ -18,9 +18,9 @@ package org.eclipse.jetty.websocket; import java.util.ArrayList; import java.util.List; -import org.eclipse.jetty.http.HttpHeaderValues; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.BufferCache.CachedBuffer; +import org.eclipse.jetty.http.HttpHeaderValue; +import org.eclipse.jetty.io.ByteBuffer; +import org.eclipse.jetty.io.BufferCache.ByteBuffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.util.StringUtil; @@ -56,7 +56,7 @@ public class WebSocketParserRFC6455Test } @Override - public int put(Buffer src) + public int put(ByteBuffer src) { return put(src.asArray(),0,src.length()); } @@ -110,7 +110,7 @@ public class WebSocketParserRFC6455Test @Test public void testCache() throws Exception { - assertEquals(HttpHeaderValues.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValues.CACHE.lookup("Upgrade")).getOrdinal()); + assertEquals(HttpHeaderValue.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValue.CACHE.lookup("Upgrade")).getOrdinal()); } @Test @@ -381,7 +381,7 @@ public class WebSocketParserRFC6455Test int _code; int _frames; - public void onFrame(byte flags, byte opcode, Buffer buffer) + public void onFrame(byte flags, byte opcode, ByteBuffer buffer) { _frames++; _flags=flags; diff --git a/pom.xml b/pom.xml index 01bce132777..e5a5893078f 100644 --- a/pom.xml +++ b/pom.xml @@ -345,11 +345,11 @@ jetty-jmx jetty-io jetty-http -