work around classloaders for field preencoders
This commit is contained in:
parent
55dec378fc
commit
64e49a1fe5
|
@ -21,7 +21,9 @@ package org.eclipse.jetty.http;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ServiceConfigurationError;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
|
@ -45,8 +47,21 @@ public class PreEncodedHttpField extends HttpField
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
List<HttpFieldPreEncoder> encoders = new ArrayList<>();
|
List<HttpFieldPreEncoder> encoders = new ArrayList<>();
|
||||||
for (HttpFieldPreEncoder enc : ServiceLoader.load(HttpFieldPreEncoder.class,PreEncodedHttpField.class.getClassLoader()))
|
Iterator<HttpFieldPreEncoder> iter = ServiceLoader.load(HttpFieldPreEncoder.class,PreEncodedHttpField.class.getClassLoader()).iterator();
|
||||||
encoders.add(enc);
|
while (iter.hasNext())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpFieldPreEncoder enc = iter.next();
|
||||||
|
}
|
||||||
|
catch(Error|RuntimeException e)
|
||||||
|
{
|
||||||
|
LOG.debug(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO avoid needing this catch all
|
||||||
|
if (encoders.size()==0)
|
||||||
|
encoders.add(new Http1FieldPreEncoder());
|
||||||
LOG.debug("HttpField encoders loaded: {}",encoders);
|
LOG.debug("HttpField encoders loaded: {}",encoders);
|
||||||
__encoders = encoders.toArray(new HttpFieldPreEncoder[encoders.size()]);
|
__encoders = encoders.toArray(new HttpFieldPreEncoder[encoders.size()]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,9 @@ public class HpackEncoder
|
||||||
|
|
||||||
private final static EnumSet<HttpHeader> __DO_NOT_INDEX =
|
private final static EnumSet<HttpHeader> __DO_NOT_INDEX =
|
||||||
EnumSet.of(
|
EnumSet.of(
|
||||||
// TODO ??? HttpHeader.C_PATH,
|
// HttpHeader.C_PATH, // TODO more data needed
|
||||||
// TODO ??? HttpHeader.DATE,
|
// HttpHeader.DATE, // TODO more data needed
|
||||||
|
HttpHeader.AUTHORIZATION,
|
||||||
HttpHeader.CONTENT_MD5,
|
HttpHeader.CONTENT_MD5,
|
||||||
HttpHeader.CONTENT_RANGE,
|
HttpHeader.CONTENT_RANGE,
|
||||||
HttpHeader.ETAG,
|
HttpHeader.ETAG,
|
||||||
|
@ -63,7 +64,9 @@ public class HpackEncoder
|
||||||
HttpHeader.IF_NONE_MATCH,
|
HttpHeader.IF_NONE_MATCH,
|
||||||
HttpHeader.IF_RANGE,
|
HttpHeader.IF_RANGE,
|
||||||
HttpHeader.IF_MATCH,
|
HttpHeader.IF_MATCH,
|
||||||
|
HttpHeader.LOCATION,
|
||||||
HttpHeader.RANGE,
|
HttpHeader.RANGE,
|
||||||
|
HttpHeader.RETRY_AFTER,
|
||||||
HttpHeader.EXPIRES,
|
HttpHeader.EXPIRES,
|
||||||
HttpHeader.LAST_MODIFIED,
|
HttpHeader.LAST_MODIFIED,
|
||||||
HttpHeader.SET_COOKIE,
|
HttpHeader.SET_COOKIE,
|
||||||
|
@ -71,7 +74,9 @@ public class HpackEncoder
|
||||||
|
|
||||||
|
|
||||||
private final static EnumSet<HttpHeader> __NEVER_INDEX =
|
private final static EnumSet<HttpHeader> __NEVER_INDEX =
|
||||||
EnumSet.of(HttpHeader.SET_COOKIE,
|
EnumSet.of(
|
||||||
|
HttpHeader.AUTHORIZATION,
|
||||||
|
HttpHeader.SET_COOKIE,
|
||||||
HttpHeader.SET_COOKIE2);
|
HttpHeader.SET_COOKIE2);
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
Loading…
Reference in New Issue