jetty-9 removed plurals from enum type names

This commit is contained in:
Greg Wilkins 2012-02-10 00:42:44 +11:00
parent efb6f84503
commit 824509b0fb
115 changed files with 804 additions and 860 deletions

View File

@ -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
{
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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)
{

View File

@ -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;
* <li>The HTTP server address, see {@link #setAddress(Address)}, or {@link #setURI(URI)}, or {@link #setURL(String)})
* <li>The HTTP request method, URI and HTTP version (see {@link #setMethod(String)}, {@link #setRequestURI(String)}, and {@link #setVersion(int)})
* <li>The request headers (see {@link #addRequestHeader(String, String)} or {@link #setRequestHeader(String, String)})
* <li>The request content (see {@link #setRequestContent(Buffer)} or {@link #setRequestContentSource(InputStream)})
* <li>The request content (see {@link #setRequestContent(ByteBuffer)} or {@link #setRequestContentSource(InputStream)})
* <li>The status of the exchange (see {@link #getStatus()})
* <li>Callbacks to handle state changes (see the onXxx methods such as {@link #onRequestComplete()} or {@link #onResponseComplete()})
* <li>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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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)));
}

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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 )
{

View File

@ -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 )
{

View File

@ -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 );

View File

@ -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() );

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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()));

View File

@ -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
}

View File

@ -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("<hello />"));
_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);

View File

@ -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();

View File

@ -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++)
{

View File

@ -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"));

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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);

View File

@ -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("<h1>??</h1>"));
_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("<h1>??</h1>"));
_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("<h1>??</h1>"));
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("<h1>??</h1>"));
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("<h1>??</h1>"));
_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("<h1>??</h1>"));
httpExchange.setTimeout(exchangeTimeout);
_httpClient.send(httpExchange);

View File

@ -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));

View File

@ -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");

View File

@ -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();

View File

@ -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"))
{

View File

@ -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;i<len;i++)
{
char ch = reason.charAt(i);
@ -428,8 +431,8 @@ public abstract class AbstractGenerator implements Generator
// block until everything is flushed
long now=System.currentTimeMillis();
long end=now+maxIdleTime;
Buffer content = _content;
Buffer buffer = _buffer;
ByteBuffer content = _content;
ByteBuffer buffer = _buffer;
if (content!=null && content.length()>0 || 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
{

View File

@ -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);
}

View File

@ -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 <code>content</code> is {@link Buffer#isImmutable immutable}.
* @throws IllegalArgumentException if <code>content</code> 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);
}

View File

@ -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.

View File

@ -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

View File

@ -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;j<reason.length();j++)
bytes[versionLength+5+j]=(byte)reason.charAt(j);
bytes[versionLength+5+reason.length()]=HttpTokens.CARRIAGE_RETURN;
bytes[versionLength+6+reason.length()]=HttpTokens.LINE_FEED;
line[versionLength+5+j]=(byte)reason.charAt(j);
line[versionLength+5+reason.length()]=HttpTokens.CARRIAGE_RETURN;
line[versionLength+6+reason.length()]=HttpTokens.LINE_FEED;
__status[i] = new Status();
__status[i]._reason=new ByteArrayBuffer(bytes,versionLength+5,bytes.length-versionLength-7,Buffer.IMMUTABLE);
__status[i]._schemeCode=new ByteArrayBuffer(bytes,0,versionLength+5,Buffer.IMMUTABLE);
__status[i]._responseLine=new ByteArrayBuffer(bytes,0,bytes.length,Buffer.IMMUTABLE);
__status[i]._reason=new byte[line.length-versionLength-7] ;
System.arraycopy(line,versionLength+5,__status[i]._reason,0,line.length-versionLength-7);
__status[i]._schemeCode=new byte[versionLength+5];
System.arraycopy(line,0,__status[i]._schemeCode,0,versionLength+5);
__status[i]._responseLine=line;
}
}
/* ------------------------------------------------------------------------------- */
public static Buffer getReasonBuffer(int code)
public static byte[] getReasonBuffer(int code)
{
Status status = code<__status.length?__status[code]:null;
if (status!=null)
@ -160,12 +160,12 @@ public class HttpGenerator extends AbstractGenerator
*
* @param content
* @param last
* @throws IllegalArgumentException if <code>content</code> is {@link Buffer#isImmutable immutable}.
* @throws IllegalArgumentException if <code>content</code> 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 && i<values.length;i++)
{
CachedBuffer cb = HttpHeaderValues.CACHE.get(values[i].trim());
CachedBuffer cb = HttpHeaderValue.CACHE.get(values[i].trim());
if (cb!=null)
{
switch(cb.getOrdinal())
{
case HttpHeaderValues.CLOSE_ORDINAL:
case HttpHeaderValue.CLOSE_ORDINAL:
close=true;
if (isResponse())
_persistent=false;
@ -584,8 +584,8 @@ public class HttpGenerator extends AbstractGenerator
_contentLength = HttpTokens.EOF_CONTENT;
break;
case HttpHeaderValues.KEEP_ALIVE_ORDINAL:
if (_version == HttpVersions.HTTP_1_0_ORDINAL)
case HttpHeaderValue.KEEP_ALIVE_ORDINAL:
if (_version == HttpVersion.HTTP_1_0_ORDINAL)
{
keep_alive = true;
if (isResponse())
@ -613,7 +613,7 @@ public class HttpGenerator extends AbstractGenerator
break;
}
case HttpHeaderValues.UPGRADE_ORDINAL:
case HttpHeaderValue.UPGRADE_ORDINAL:
{
// special case for websocket connection ordering
if (isResponse())
@ -622,7 +622,7 @@ public class HttpGenerator extends AbstractGenerator
continue;
}
}
case HttpHeaderValues.CLOSE_ORDINAL:
case HttpHeaderValue.CLOSE_ORDINAL:
{
close=true;
if (isResponse())
@ -631,9 +631,9 @@ public class HttpGenerator extends AbstractGenerator
_contentLength = HttpTokens.EOF_CONTENT;
break;
}
case HttpHeaderValues.KEEP_ALIVE_ORDINAL:
case HttpHeaderValue.KEEP_ALIVE_ORDINAL:
{
if (_version == HttpVersions.HTTP_1_0_ORDINAL)
if (_version == HttpVersion.HTTP_1_0_ORDINAL)
{
keep_alive = true;
if (isResponse())
@ -654,7 +654,7 @@ public class HttpGenerator extends AbstractGenerator
// Do NOT add yet!
break;
case HttpHeaders.SERVER_ORDINAL:
case HttpHeader.SERVER_ORDINAL:
if (getSendServerVersion())
{
has_server=true;
@ -694,7 +694,7 @@ public class HttpGenerator extends AbstractGenerator
if (content_length == null && (isResponse() || _contentLength>0 || 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());
}
}

View File

@ -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<HttpHeaders> CACHE= new StringMap<HttpHeaders>(true);
public final static StringMap<HttpHeader> CACHE= new StringMap<HttpHeader>(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());

View File

@ -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<HttpHeaderValues> CACHE= new StringMap<HttpHeaderValues>(true);
public final static StringMap<HttpHeaderValue> CACHE= new StringMap<HttpHeaderValue>(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<HttpHeaders> __known =
EnumSet.of(HttpHeaders.CONNECTION,
HttpHeaders.TRANSFER_ENCODING,
HttpHeaders.CONTENT_ENCODING);
private static EnumSet<HttpHeader> __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;

View File

@ -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<HttpMethods> CACHE= new StringMap<HttpMethods>(true);
public final static StringMap<HttpMethod> CACHE= new StringMap<HttpMethod>(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());
}

View File

@ -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

View File

@ -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<HttpSchemes> CACHE= new StringMap<HttpSchemes>(true);
public final static StringMap<HttpScheme> CACHE= new StringMap<HttpScheme>(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);

View File

@ -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);
}

View File

@ -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<HttpVersions> CACHE= new StringMap<HttpVersions>(true);
public final static StringMap<HttpVersion> CACHE= new StringMap<HttpVersion>(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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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));

View File

@ -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<headers.length;i++)
@ -225,7 +225,7 @@ public class HttpGeneratorClientTest
if (body!=null)
{
int inc=1+body.length()/chunks;
Buffer buf=new ByteArrayBuffer(body);
ByteBuffer buf=new ByteArrayBuffer(body);
View view = new View(buf);
for (int i=1;i<chunks;i++)
{
@ -291,7 +291,7 @@ public class HttpGeneratorClientTest
private int index=0;
@Override
public void content(Buffer ref)
public void content(ByteBuffer ref)
{
if (index == 0)
content= "";
@ -300,7 +300,7 @@ public class HttpGeneratorClientTest
}
@Override
public void startRequest(Buffer tok0, Buffer tok1, Buffer tok2)
public void startRequest(ByteBuffer tok0, ByteBuffer tok1, ByteBuffer tok2)
{
h= -1;
hdr= new String[9];
@ -319,7 +319,7 @@ public class HttpGeneratorClientTest
* @see org.eclipse.jetty.EventHandler#startResponse(org.eclipse.io.Buffer, int, org.eclipse.io.Buffer)
*/
@Override
public void startResponse(Buffer version, int status, Buffer reason)
public void startResponse(ByteBuffer version, int status, ByteBuffer reason)
{
h= -1;
hdr= new String[9];
@ -334,7 +334,7 @@ public class HttpGeneratorClientTest
}
@Override
public void parsedHeader(Buffer name,Buffer value)
public void parsedHeader(ByteBuffer name,ByteBuffer value)
{
hdr[++h]= name.toString();
val[h]= value.toString();

View File

@ -18,12 +18,12 @@ import static org.junit.Assert.assertFalse;
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;
/**
@ -40,8 +40,8 @@ public class HttpGeneratorTest
@Test
public void testRequest() 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 hg = new HttpGenerator(new SimpleBuffers(sb,bb),endp);
@ -61,8 +61,8 @@ public class HttpGeneratorTest
@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);
@ -181,7 +181,7 @@ public class HttpGeneratorTest
if (_body!=null)
{
int inc=1+_body.length()/chunks;
Buffer buf=new ByteArrayBuffer(_body);
ByteBuffer buf=new ByteArrayBuffer(_body);
View view = new View(buf);
for (int i=1;i<chunks;i++)
{
@ -245,7 +245,7 @@ public class HttpGeneratorTest
private int index=0;
@Override
public void content(Buffer ref)
public void content(ByteBuffer ref)
{
if (index == 0)
content= "";
@ -254,7 +254,7 @@ public class HttpGeneratorTest
}
@Override
public void startRequest(Buffer tok0, Buffer tok1, Buffer tok2)
public void startRequest(ByteBuffer tok0, ByteBuffer tok1, ByteBuffer tok2)
{
h= -1;
hdr= new String[9];
@ -273,7 +273,7 @@ public class HttpGeneratorTest
* @see org.eclipse.jetty.EventHandler#startResponse(org.eclipse.io.Buffer, int, org.eclipse.io.Buffer)
*/
@Override
public void startResponse(Buffer version, int status, Buffer reason)
public void startResponse(ByteBuffer version, int status, ByteBuffer reason)
{
h= -1;
hdr= new String[9];
@ -288,7 +288,7 @@ public class HttpGeneratorTest
}
@Override
public void parsedHeader(Buffer name,Buffer value)
public void parsedHeader(ByteBuffer name,ByteBuffer value)
{
hdr[++h]= name.toString();
val[h]= value.toString();

View File

@ -16,11 +16,8 @@ package org.eclipse.jetty.http;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import org.eclipse.jetty.io.SimpleBuffers;
import org.eclipse.jetty.io.bio.StringEndPoint;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
import org.junit.Test;

View File

@ -28,6 +28,6 @@ public class HttpStatusCodeTest
public void testHttpMethod()
{
assertEquals("GET",HttpMethods.GET.toString());
assertEquals("GET",HttpMethod.GET.toString());
}
}

View File

@ -23,8 +23,8 @@ import javax.servlet.ServletRequest;
import org.eclipse.jetty.http.HttpBuffers;
import org.eclipse.jetty.http.HttpBuffersImpl;
import org.eclipse.jetty.http.HttpFields;
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.io.Buffers;
import org.eclipse.jetty.io.Buffers.Type;
import org.eclipse.jetty.io.Connection;
@ -62,9 +62,9 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
private ThreadPool _threadPool;
private String _host;
private int _port = 0;
private String _integralScheme = HttpSchemes.HTTPS;
private String _integralScheme = HttpScheme.HTTPS;
private int _integralPort = 0;
private String _confidentialScheme = HttpSchemes.HTTPS;
private String _confidentialScheme = HttpScheme.HTTPS;
private int _confidentialPort = 0;
private int _acceptQueueSize = 0;
private int _acceptors = 1;
@ -73,10 +73,10 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
private boolean _forwarded;
private String _hostHeader;
private String _forwardedHostHeader = HttpHeaders.X_FORWARDED_HOST;
private String _forwardedServerHeader = HttpHeaders.X_FORWARDED_SERVER;
private String _forwardedForHeader = HttpHeaders.X_FORWARDED_FOR;
private String _forwardedProtoHeader = HttpHeaders.X_FORWARDED_PROTO;
private String _forwardedHostHeader = HttpHeader.X_FORWARDED_HOST;
private String _forwardedServerHeader = HttpHeader.X_FORWARDED_SERVER;
private String _forwardedForHeader = HttpHeader.X_FORWARDED_FOR;
private String _forwardedProtoHeader = HttpHeader.X_FORWARDED_PROTO;
private String _forwardedCipherSuiteHeader;
private String _forwardedSslSessionIdHeader;
private boolean _reuseAddress = true;
@ -420,7 +420,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
if(ssl_session_id!=null)
{
request.setAttribute("javax.servlet.request.ssl_session_id", ssl_session_id);
request.setScheme(HttpSchemes.HTTPS);
request.setScheme(HttpScheme.HTTPS);
}
}
@ -433,7 +433,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
if (_hostHeader != null)
{
// Update host header
httpFields.put(HttpHeaders.HOST_BUFFER,_hostHeader);
httpFields.put(HttpHeader.HOST_BUFFER,_hostHeader);
request.setServerName(null);
request.setServerPort(-1);
request.getServerName();
@ -441,7 +441,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
else if (forwardedHost != null)
{
// Update host header
httpFields.put(HttpHeaders.HOST_BUFFER,forwardedHost);
httpFields.put(HttpHeader.HOST_BUFFER,forwardedHost);
request.setServerName(null);
request.setServerPort(-1);
request.getServerName();
@ -558,7 +558,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
*/
public boolean isConfidential(Request request)
{
return _forwarded && request.getScheme().equalsIgnoreCase(HttpSchemes.HTTPS);
return _forwarded && request.getScheme().equalsIgnoreCase(HttpScheme.HTTPS);
}
/* ------------------------------------------------------------ */

View File

@ -29,18 +29,18 @@ import org.eclipse.jetty.http.HttpContent;
import org.eclipse.jetty.http.HttpException;
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.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.http.Parser;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.BufferCache.CachedBuffer;
import org.eclipse.jetty.io.ByteBuffer;
import org.eclipse.jetty.io.BufferCache.ByteBuffer;
import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
@ -437,7 +437,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
{
_uri.getPort();
info=URIUtil.canonicalPath(_uri.getDecodedPath());
if (info==null && !_request.getMethod().equals(HttpMethods.CONNECT))
if (info==null && !_request.getMethod().equals(HttpMethod.CONNECT))
throw new HttpException(400);
_request.setPathInfo(info);
@ -720,7 +720,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
* org.eclipse.io.Buffer, org.eclipse.io.Buffer)
*/
@Override
public void startRequest(Buffer method, Buffer uri, Buffer version) throws IOException
public void startRequest(ByteBuffer method, ByteBuffer uri, ByteBuffer version) throws IOException
{
uri=uri.asImmutableBuffer();
@ -738,13 +738,13 @@ public abstract class AbstractHttpConnection extends AbstractConnection
try
{
_head=false;
switch (HttpMethods.CACHE.getOrdinal(method))
switch (HttpMethod.CACHE.getOrdinal(method))
{
case HttpMethods.CONNECT_ORDINAL:
case HttpMethod.CONNECT_ORDINAL:
_uri.parseConnect(uri.array(), uri.getIndex(), uri.length());
break;
case HttpMethods.HEAD_ORDINAL:
case HttpMethod.HEAD_ORDINAL:
_head=true;
_uri.parse(uri.array(), uri.getIndex(), uri.length());
break;
@ -757,16 +757,16 @@ public abstract class AbstractHttpConnection extends AbstractConnection
if (version==null)
{
_request.setProtocol(HttpVersions.HTTP_0_9);
_version=HttpVersions.HTTP_0_9_ORDINAL;
_request.setProtocol(HttpVersion.HTTP_0_9);
_version=HttpVersion.HTTP_0_9_ORDINAL;
}
else
{
version= HttpVersions.CACHE.get(version);
version= HttpVersion.CACHE.get(version);
if (version==null)
throw new HttpException(HttpStatus.BAD_REQUEST_400,null);
_version = HttpVersions.CACHE.getOrdinal(version);
if (_version <= 0) _version = HttpVersions.HTTP_1_0_ORDINAL;
_version = HttpVersion.CACHE.getOrdinal(version);
if (_version <= 0) _version = HttpVersion.HTTP_1_0_ORDINAL;
_request.setProtocol(version.toString());
}
}
@ -783,25 +783,25 @@ public abstract class AbstractHttpConnection extends AbstractConnection
* @see org.eclipse.jetty.server.server.HttpParser.EventHandler#parsedHeaderValue(org.eclipse.io.Buffer)
*/
@Override
public void parsedHeader(Buffer name, Buffer value)
public void parsedHeader(ByteBuffer name, ByteBuffer value)
{
int ho = HttpHeaders.CACHE.getOrdinal(name);
int ho = HttpHeader.CACHE.getOrdinal(name);
switch (ho)
{
case HttpHeaders.HOST_ORDINAL:
case HttpHeader.HOST_ORDINAL:
// TODO check if host matched a host in the URI.
_host = true;
break;
case HttpHeaders.EXPECT_ORDINAL:
value = HttpHeaderValues.CACHE.lookup(value);
switch(HttpHeaderValues.CACHE.getOrdinal(value))
case HttpHeader.EXPECT_ORDINAL:
value = HttpHeaderValue.CACHE.lookup(value);
switch(HttpHeaderValue.CACHE.getOrdinal(value))
{
case HttpHeaderValues.CONTINUE_ORDINAL:
case HttpHeaderValue.CONTINUE_ORDINAL:
_expect100Continue=_generator instanceof HttpGenerator;
break;
case HttpHeaderValues.PROCESSING_ORDINAL:
case HttpHeaderValue.PROCESSING_ORDINAL:
_expect102Processing=_generator instanceof HttpGenerator;
break;
@ -809,17 +809,17 @@ public abstract class AbstractHttpConnection extends AbstractConnection
String[] values = value.toString().split(",");
for (int i=0;values!=null && i<values.length;i++)
{
CachedBuffer cb=HttpHeaderValues.CACHE.get(values[i].trim());
CachedBuffer cb=HttpHeaderValue.CACHE.get(values[i].trim());
if (cb==null)
_expect=true;
else
{
switch(cb.getOrdinal())
{
case HttpHeaderValues.CONTINUE_ORDINAL:
case HttpHeaderValue.CONTINUE_ORDINAL:
_expect100Continue=_generator instanceof HttpGenerator;
break;
case HttpHeaderValues.PROCESSING_ORDINAL:
case HttpHeaderValue.PROCESSING_ORDINAL:
_expect102Processing=_generator instanceof HttpGenerator;
break;
default:
@ -830,12 +830,12 @@ public abstract class AbstractHttpConnection extends AbstractConnection
}
break;
case HttpHeaders.ACCEPT_ENCODING_ORDINAL:
case HttpHeaders.USER_AGENT_ORDINAL:
value = HttpHeaderValues.CACHE.lookup(value);
case HttpHeader.ACCEPT_ENCODING_ORDINAL:
case HttpHeader.USER_AGENT_ORDINAL:
value = HttpHeaderValue.CACHE.lookup(value);
break;
case HttpHeaders.CONTENT_TYPE_ORDINAL:
case HttpHeader.CONTENT_TYPE_ORDINAL:
value = MimeTypes.CACHE.lookup(value);
_charset=MimeTypes.getCharsetFromContentType(value);
break;
@ -854,16 +854,16 @@ public abstract class AbstractHttpConnection extends AbstractConnection
_generator.setVersion(_version);
switch (_version)
{
case HttpVersions.HTTP_0_9_ORDINAL:
case HttpVersion.HTTP_0_9_ORDINAL:
break;
case HttpVersions.HTTP_1_0_ORDINAL:
case HttpVersion.HTTP_1_0_ORDINAL:
_generator.setHead(_head);
if (_parser.isPersistent())
{
_responseFields.add(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.KEEP_ALIVE_BUFFER);
_responseFields.add(HttpHeader.CONNECTION_BUFFER,HttpHeaderValue.KEEP_ALIVE_BUFFER);
_generator.setPersistent(true);
}
else if (HttpMethods.CONNECT.equals(_request.getMethod()))
else if (HttpMethod.CONNECT.equals(_request.getMethod()))
{
_generator.setPersistent(true);
_parser.setPersistent(true);
@ -873,12 +873,12 @@ public abstract class AbstractHttpConnection extends AbstractConnection
_generator.setDate(_request.getTimeStampBuffer());
break;
case HttpVersions.HTTP_1_1_ORDINAL:
case HttpVersion.HTTP_1_1_ORDINAL:
_generator.setHead(_head);
if (!_parser.isPersistent())
{
_responseFields.add(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.CLOSE_BUFFER);
_responseFields.add(HttpHeader.CONNECTION_BUFFER,HttpHeaderValue.CLOSE_BUFFER);
_generator.setPersistent(false);
}
if (_server.getSendDateHeader())
@ -888,7 +888,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
{
LOG.debug("!host {}",this);
_generator.setResponse(HttpStatus.BAD_REQUEST_400, null);
_responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER);
_responseFields.put(HttpHeader.CONNECTION_BUFFER, HttpHeaderValue.CLOSE_BUFFER);
_generator.completeHeader(_responseFields, true);
_generator.complete();
return;
@ -898,7 +898,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
{
LOG.debug("!expectation {}",this);
_generator.setResponse(HttpStatus.EXPECTATION_FAILED_417, null);
_responseFields.put(HttpHeaders.CONNECTION_BUFFER, HttpHeaderValues.CLOSE_BUFFER);
_responseFields.put(HttpHeader.CONNECTION_BUFFER, HttpHeaderValue.CLOSE_BUFFER);
_generator.completeHeader(_responseFields, true);
_generator.complete();
return;
@ -923,7 +923,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
* @see org.eclipse.jetty.server.server.HttpParser.EventHandler#content(int, org.eclipse.io.Buffer)
*/
@Override
public void content(Buffer ref) throws IOException
public void content(ByteBuffer ref) throws IOException
{
if (_delayedHandling)
{
@ -956,7 +956,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
* org.eclipse.io.Buffer)
*/
@Override
public void startResponse(Buffer version, int status, Buffer reason)
public void startResponse(ByteBuffer version, int status, ByteBuffer reason)
{
if (LOG.isDebugEnabled())
LOG.debug("Bad request!: "+version+" "+status+" "+reason);
@ -1020,7 +1020,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
}
/* ------------------------------------------------------------ */
public void sendResponse(Buffer response) throws IOException
public void sendResponse(ByteBuffer response) throws IOException
{
((HttpGenerator)super._generator).sendResponse(response);
}
@ -1040,42 +1040,42 @@ public abstract class AbstractHttpConnection extends AbstractConnection
if (content instanceof HttpContent)
{
HttpContent httpContent = (HttpContent) content;
Buffer contentType = httpContent.getContentType();
if (contentType != null && !_responseFields.containsKey(HttpHeaders.CONTENT_TYPE_BUFFER))
ByteBuffer contentType = httpContent.getContentType();
if (contentType != null && !_responseFields.containsKey(HttpHeader.CONTENT_TYPE_BUFFER))
{
String enc = _response.getSetCharacterEncoding();
if(enc==null)
_responseFields.add(HttpHeaders.CONTENT_TYPE_BUFFER, contentType);
_responseFields.add(HttpHeader.CONTENT_TYPE_BUFFER, contentType);
else
{
if(contentType instanceof CachedBuffer)
{
CachedBuffer content_type = ((CachedBuffer)contentType).getAssociate(enc);
if(content_type!=null)
_responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER, content_type);
_responseFields.put(HttpHeader.CONTENT_TYPE_BUFFER, content_type);
else
{
_responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,
_responseFields.put(HttpHeader.CONTENT_TYPE_BUFFER,
contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(enc,";= "));
}
}
else
{
_responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,
_responseFields.put(HttpHeader.CONTENT_TYPE_BUFFER,
contentType+";charset="+QuotedStringTokenizer.quoteIfNeeded(enc,";= "));
}
}
}
if (httpContent.getContentLength() > 0)
_responseFields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER, httpContent.getContentLength());
Buffer lm = httpContent.getLastModified();
_responseFields.putLongField(HttpHeader.CONTENT_LENGTH_BUFFER, httpContent.getContentLength());
ByteBuffer lm = httpContent.getLastModified();
long lml=httpContent.getResource().lastModified();
if (lm != null)
_responseFields.put(HttpHeaders.LAST_MODIFIED_BUFFER, lm);
_responseFields.put(HttpHeader.LAST_MODIFIED_BUFFER, lm);
else if (httpContent.getResource()!=null)
{
if (lml!=-1)
_responseFields.putDateField(HttpHeaders.LAST_MODIFIED_BUFFER, lml);
_responseFields.putDateField(HttpHeader.LAST_MODIFIED_BUFFER, lml);
}
boolean direct=_connector instanceof NIOConnector && ((NIOConnector)_connector).getUseDirectBuffers() && !(_connector instanceof SslConnector);
@ -1086,14 +1086,14 @@ public abstract class AbstractHttpConnection extends AbstractConnection
else if (content instanceof Resource)
{
resource=(Resource)content;
_responseFields.putDateField(HttpHeaders.LAST_MODIFIED_BUFFER, resource.lastModified());
_responseFields.putDateField(HttpHeader.LAST_MODIFIED_BUFFER, resource.lastModified());
content=resource.getInputStream();
}
// Process content.
if (content instanceof Buffer)
if (content instanceof ByteBuffer)
{
super._generator.addContent((Buffer) content, Generator.LAST);
super._generator.addContent((ByteBuffer) content, Generator.LAST);
commitResponse(Generator.LAST);
}
else if (content instanceof InputStream)
@ -1103,7 +1103,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
try
{
int max = super._generator.prepareUncheckedAddContent();
Buffer buffer = super._generator.getUncheckedBuffer();
ByteBuffer buffer = super._generator.getUncheckedBuffer();
int len=buffer.readFrom(in,max);

View File

@ -18,7 +18,7 @@ import java.io.IOException;
import javax.servlet.ServletInputStream;
import org.eclipse.jetty.http.HttpParser;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteBuffer;
public class HttpInput extends ServletInputStream
{
@ -40,7 +40,7 @@ public class HttpInput extends ServletInputStream
public int read() throws IOException
{
int c=-1;
Buffer content=_parser.blockForContent(_connection.getMaxIdleTime());
ByteBuffer content=_parser.blockForContent(_connection.getMaxIdleTime());
if (content!=null)
c= 0xff & content.get();
return c;
@ -54,7 +54,7 @@ public class HttpInput extends ServletInputStream
public int read(byte[] b, int off, int len) throws IOException
{
int l=-1;
Buffer content=_parser.blockForContent(_connection.getMaxIdleTime());
ByteBuffer content=_parser.blockForContent(_connection.getMaxIdleTime());
if (content!=null)
l= content.get(b, off, len);
return l;

View File

@ -20,7 +20,7 @@ import javax.servlet.ServletOutputStream;
import org.eclipse.jetty.http.AbstractGenerator;
import org.eclipse.jetty.http.Generator;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteBuffer;
import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.ByteArrayOutputStream2;
@ -146,7 +146,7 @@ public class HttpOutput extends ServletOutputStream
}
/* ------------------------------------------------------------ */
private void write(Buffer buffer) throws IOException
private void write(ByteBuffer buffer) throws IOException
{
if (_closed)
throw new IOException("Closed");

View File

@ -22,7 +22,7 @@ import java.util.TimeZone;
import javax.servlet.http.Cookie;
import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.PathMap;
import org.eclipse.jetty.util.DateCache;
import org.eclipse.jetty.util.RolloverFileOutputStream;
@ -467,7 +467,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
String addr = null;
if (_preferProxiedForAddress)
{
addr = request.getHeader(HttpHeaders.X_FORWARDED_FOR);
addr = request.getHeader(HttpHeader.X_FORWARDED_FOR);
}
if (addr == null)
@ -601,7 +601,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
Response response,
StringBuilder b) throws IOException
{
String referer = request.getHeader(HttpHeaders.REFERER);
String referer = request.getHeader(HttpHeader.REFERER);
if (referer == null)
b.append("\"-\" ");
else
@ -611,7 +611,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
b.append("\" ");
}
String agent = request.getHeader(HttpHeaders.USER_AGENT);
String agent = request.getHeader(HttpHeader.USER_AGENT);
if (agent == null)
b.append("\"-\" ");
else

View File

@ -57,15 +57,15 @@ import org.eclipse.jetty.continuation.ContinuationListener;
import org.eclipse.jetty.http.HttpCookie;
import org.eclipse.jetty.http.HttpException;
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.HttpParser;
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.Buffer;
import org.eclipse.jetty.io.BufferUtil;
import org.eclipse.jetty.io.ByteBuffer;
import org.eclipse.jetty.io.ByteBuffer;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.nio.DirectNIOBuffer;
import org.eclipse.jetty.io.nio.IndirectNIOBuffer;
@ -154,7 +154,7 @@ public class Request implements HttpServletRequest
private boolean _paramsExtracted;
private String _pathInfo;
private int _port;
private String _protocol = HttpVersions.HTTP_1_1;
private String _protocol = HttpVersion.HTTP_1_1;
private String _queryEncoding;
private String _queryString;
private BufferedReader _reader;
@ -175,7 +175,7 @@ public class Request implements HttpServletRequest
private long _timeStamp;
private long _dispatchTime;
private Buffer _timeStampBuffer;
private ByteBuffer _timeStampBuffer;
private HttpURI _uri;
private MultiPartInputStream _multiPartInputStream; //if the request is a multi-part mime
@ -251,7 +251,7 @@ public class Request implements HttpServletRequest
content_type = HttpFields.valueParameters(content_type,null);
if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState == __NONE
&& (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod())))
&& (HttpMethod.POST.equals(getMethod()) || HttpMethod.PUT.equals(getMethod())))
{
int content_length = getContentLength();
if (content_length != 0)
@ -419,7 +419,7 @@ public class Request implements HttpServletRequest
*/
public int getContentLength()
{
return (int)_connection.getRequestFields().getLongField(HttpHeaders.CONTENT_LENGTH_BUFFER);
return (int)_connection.getRequestFields().getLongField(HttpHeader.CONTENT_LENGTH_BUFFER);
}
public long getContentRead()
@ -436,7 +436,7 @@ public class Request implements HttpServletRequest
*/
public String getContentType()
{
return _connection.getRequestFields().getStringField(HttpHeaders.CONTENT_TYPE_BUFFER);
return _connection.getRequestFields().getStringField(HttpHeader.CONTENT_TYPE_BUFFER);
}
/* ------------------------------------------------------------ */
@ -468,7 +468,7 @@ public class Request implements HttpServletRequest
_cookiesExtracted = true;
Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.COOKIE_BUFFER);
Enumeration enm = _connection.getRequestFields().getValues(HttpHeader.COOKIE_BUFFER);
// Handle no cookies
if (enm != null)
@ -576,7 +576,7 @@ public class Request implements HttpServletRequest
*/
public Locale getLocale()
{
Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE,HttpFields.__separators);
Enumeration enm = _connection.getRequestFields().getValues(HttpHeader.ACCEPT_LANGUAGE,HttpFields.__separators);
// handle no locale
if (enm == null || !enm.hasMoreElements())
@ -613,7 +613,7 @@ public class Request implements HttpServletRequest
public Enumeration getLocales()
{
Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE,HttpFields.__separators);
Enumeration enm = _connection.getRequestFields().getValues(HttpHeader.ACCEPT_LANGUAGE,HttpFields.__separators);
// handle no locale
if (enm == null || !enm.hasMoreElements())
@ -1020,7 +1020,7 @@ public class Request implements HttpServletRequest
return _serverName;
// Return host from header field
Buffer hostPort = _connection.getRequestFields().get(HttpHeaders.HOST_BUFFER);
ByteBuffer hostPort = _connection.getRequestFields().get(HttpHeader.HOST_BUFFER);
if (hostPort != null)
{
loop: for (int i = hostPort.putIndex(); 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);
}

View File

@ -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<Buffer> _indirectBuffer=new AtomicReference<Buffer>();
AtomicReference<Buffer> _directBuffer=new AtomicReference<Buffer>();
AtomicReference<ByteBuffer> _indirectBuffer=new AtomicReference<ByteBuffer>();
AtomicReference<ByteBuffer> _directBuffer=new AtomicReference<ByteBuffer>();
/* ------------------------------------------------------------ */
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());

View File

@ -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<values.length;i++)
{
CachedBuffer cb = HttpHeaderValues.CACHE.get(values[0].trim());
CachedBuffer cb = HttpHeaderValue.CACHE.get(values[0].trim());
if (cb!=null)
{
switch(cb.getOrdinal())
{
case HttpHeaderValues.CLOSE_ORDINAL:
response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.CLOSE_BUFFER);
case HttpHeaderValue.CLOSE_ORDINAL:
response_fields.put(HttpHeader.CONNECTION_BUFFER,HttpHeaderValue.CLOSE_BUFFER);
break;
case HttpHeaderValues.KEEP_ALIVE_ORDINAL:
if (HttpVersions.HTTP_1_0.equalsIgnoreCase(_connection.getRequest().getProtocol()))
response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.KEEP_ALIVE);
case HttpHeaderValue.KEEP_ALIVE_ORDINAL:
if (HttpVersion.HTTP_1_0.equalsIgnoreCase(_connection.getRequest().getProtocol()))
response_fields.put(HttpHeader.CONNECTION_BUFFER,HttpHeaderValue.KEEP_ALIVE);
break;
case HttpHeaderValues.TE_ORDINAL:
response_fields.put(HttpHeaders.CONNECTION_BUFFER,HttpHeaderValues.TE);
case HttpHeaderValue.TE_ORDINAL:
response_fields.put(HttpHeader.CONNECTION_BUFFER,HttpHeaderValue.TE);
break;
}
}
@ -1111,7 +1111,7 @@ public class Response implements HttpServletResponse
return;
_locale = locale;
_connection.getResponseFields().put(HttpHeaders.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-'));
_connection.getResponseFields().put(HttpHeader.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-'));
if (_explicitEncoding || _outputState!=0 )
return;
@ -1143,7 +1143,7 @@ public class Response implements HttpServletResponse
}
_cachedMimeType=MimeTypes.CACHE.get(_mimeType);
_connection.getResponseFields().put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType);
_connection.getResponseFields().put(HttpHeader.CONTENT_TYPE_BUFFER,_contentType);
}
}
}

View File

@ -22,7 +22,7 @@ import java.util.HashSet;
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;
@ -217,7 +217,7 @@ public class SocketConnector extends AbstractConnector
}
@Override
public int fill(Buffer buffer) throws IOException
public int fill(ByteBuffer buffer) throws IOException
{
int l = super.fill(buffer);
if (l<0)

View File

@ -15,10 +15,10 @@ 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.HttpParser;
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.EndPoint;
@ -172,7 +172,7 @@ public class ConnectHandler extends HandlerWrapper
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (HttpMethods.CONNECT.equalsIgnoreCase(request.getMethod()))
if (HttpMethod.CONNECT.equalsIgnoreCase(request.getMethod()))
{
_logger.debug("CONNECT request for {}", request.getRequestURI());
try
@ -234,8 +234,8 @@ public class ConnectHandler extends HandlerWrapper
// connection is installed (it is only installed after returning from this method)
// 2. when the client sends data before this unread data has been written.
AbstractHttpConnection httpConnection = AbstractHttpConnection.getCurrentConnection();
Buffer headerBuffer = ((HttpParser)httpConnection.getParser()).getHeaderBuffer();
Buffer bodyBuffer = ((HttpParser)httpConnection.getParser()).getBodyBuffer();
ByteBuffer headerBuffer = ((HttpParser)httpConnection.getParser()).getHeaderBuffer();
ByteBuffer bodyBuffer = ((HttpParser)httpConnection.getParser()).getBodyBuffer();
int length = headerBuffer == null ? 0 : headerBuffer.length();
length += bodyBuffer == null ? 0 : bodyBuffer.length();
IndirectNIOBuffer buffer = null;
@ -271,7 +271,7 @@ public class ConnectHandler extends HandlerWrapper
upgradeConnection(request, response, clientToProxy);
}
private ClientToProxyConnection prepareConnections(ConcurrentMap<String, Object> context, SocketChannel channel, Buffer buffer)
private ClientToProxyConnection prepareConnections(ConcurrentMap<String, Object> 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<String, Object> context, Buffer buffer)
protected ProxyToServerConnection newProxyToServerConnection(ConcurrentMap<String, Object> 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<String, Object> context) throws IOException
protected int read(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap<String, Object> 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<String, Object> context) throws IOException
protected int write(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap<String, Object> 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<String, Object> _context;
private volatile Buffer _data;
private volatile ByteBuffer _data;
private volatile ClientToProxyConnection _toClient;
private volatile long _timestamp;
private volatile AsyncEndPoint _endPoint;
public ProxyToServerConnection(ConcurrentMap<String, Object> context, Buffer data)
public ProxyToServerConnection(ConcurrentMap<String, Object> 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<String, Object> _context;
private final SocketChannel _channel;
private final EndPoint _endPoint;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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)
{

View File

@ -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);

View File

@ -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());
}
}

View File

@ -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);

View File

@ -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
{

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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("<html><h1>FOO</h1></html>");

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -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<String, Object> context) throws IOException
protected int read(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap<String, Object> context) throws IOException
{
assertEquals(contextValue, context.get(contextKey));
return super.read(endPoint, buffer, context);
}
@Override
protected int write(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException
protected int write(EndPoint endPoint, ByteBuffer buffer, ConcurrentMap<String, Object> context) throws IOException
{
assertEquals(contextValue, context.get(contextKey));
return super.write(endPoint, buffer, context);

View File

@ -60,7 +60,7 @@ public class StringMap<O> extends AbstractMap<String,O>
public StringMap(final boolean ignoreCase)
{
_caseInsensitive=ignoreCase;
_map = new TreeMap<>(new Comparator<Object>()
_map = new TreeMap<Object,O>(new Comparator<Object>()
{
@Override
public int compare(Object o1, Object o2)

View File

@ -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);

View File

@ -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))
{

View File

@ -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);
}

View File

@ -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);

View File

@ -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<Extension> getExtensions();

View File

@ -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
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
}

View File

@ -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(),

Some files were not shown because too many files have changed in this diff Show More