Fixed construction of MetaData.Request and handling of HttpFields by MetaData.

This commit is contained in:
Simone Bordet 2015-02-20 16:36:11 +01:00
parent a01d85f0d9
commit f61cfb7016
2 changed files with 4 additions and 21 deletions

View File

@ -27,11 +27,6 @@ public class MetaData implements Iterable<HttpField>
private HttpFields _fields;
private long _contentLength;
public MetaData()
{
this(null, null);
}
public MetaData(HttpVersion version, HttpFields fields)
{
this(version, fields, Long.MIN_VALUE);
@ -49,7 +44,6 @@ public class MetaData implements Iterable<HttpField>
_httpVersion = null;
if (_fields != null)
_fields.clear();
_fields = null;
_contentLength = Long.MIN_VALUE;
}
@ -87,15 +81,6 @@ public class MetaData implements Iterable<HttpField>
return _fields;
}
/**
* @param fields the HTTP fields to set
*/
public void setFields(HttpFields fields)
{
_fields = fields;
_contentLength = Long.MIN_VALUE;
}
/**
* @return the content length if available, otherwise {@link Long#MIN_VALUE}
*/
@ -136,8 +121,9 @@ public class MetaData implements Iterable<HttpField>
private String _method;
private HttpURI _uri;
public Request()
public Request(HttpFields fields)
{
this(null, null, null, fields);
}
public Request(String method, HttpURI uri, HttpVersion version, HttpFields fields)

View File

@ -34,7 +34,6 @@ import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
@ -47,15 +46,14 @@ class HttpChannelOverHttp extends HttpChannel implements HttpParser.RequestHandl
{
private static final Logger LOG = Log.getLogger(HttpChannelOverHttp.class);
private final HttpConnection _httpConnection;
private final HttpFields _fields = new HttpFields();
private final MetaData.Request _metadata = new MetaData.Request(_fields);
private final HttpConnection _httpConnection;
private HttpField _connection;
private boolean _unknownExpectation = false;
private boolean _expect100Continue = false;
private boolean _expect102Processing = false;
private final MetaData.Request _metadata = new MetaData.Request();
public HttpChannelOverHttp(HttpConnection httpConnection, Connector connector, HttpConfiguration config, EndPoint endPoint, HttpTransport transport)
{
this(httpConnection,connector,config,endPoint,transport,new HttpInputOverHTTP(httpConnection));
@ -65,7 +63,6 @@ class HttpChannelOverHttp extends HttpChannel implements HttpParser.RequestHandl
{
super(connector,config,endPoint,transport,input);
_httpConnection = httpConnection;
_metadata.setFields(_fields);
_metadata.setURI(new HttpURI());
}