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.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
@ -45,8 +47,21 @@ public class PreEncodedHttpField extends HttpField
|
|||
static
|
||||
{
|
||||
List<HttpFieldPreEncoder> encoders = new ArrayList<>();
|
||||
for (HttpFieldPreEncoder enc : ServiceLoader.load(HttpFieldPreEncoder.class,PreEncodedHttpField.class.getClassLoader()))
|
||||
encoders.add(enc);
|
||||
Iterator<HttpFieldPreEncoder> iter = ServiceLoader.load(HttpFieldPreEncoder.class,PreEncodedHttpField.class.getClassLoader()).iterator();
|
||||
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);
|
||||
__encoders = encoders.toArray(new HttpFieldPreEncoder[encoders.size()]);
|
||||
}
|
||||
|
|
|
@ -53,8 +53,9 @@ public class HpackEncoder
|
|||
|
||||
private final static EnumSet<HttpHeader> __DO_NOT_INDEX =
|
||||
EnumSet.of(
|
||||
// TODO ??? HttpHeader.C_PATH,
|
||||
// TODO ??? HttpHeader.DATE,
|
||||
// HttpHeader.C_PATH, // TODO more data needed
|
||||
// HttpHeader.DATE, // TODO more data needed
|
||||
HttpHeader.AUTHORIZATION,
|
||||
HttpHeader.CONTENT_MD5,
|
||||
HttpHeader.CONTENT_RANGE,
|
||||
HttpHeader.ETAG,
|
||||
|
@ -63,7 +64,9 @@ public class HpackEncoder
|
|||
HttpHeader.IF_NONE_MATCH,
|
||||
HttpHeader.IF_RANGE,
|
||||
HttpHeader.IF_MATCH,
|
||||
HttpHeader.LOCATION,
|
||||
HttpHeader.RANGE,
|
||||
HttpHeader.RETRY_AFTER,
|
||||
HttpHeader.EXPIRES,
|
||||
HttpHeader.LAST_MODIFIED,
|
||||
HttpHeader.SET_COOKIE,
|
||||
|
@ -71,7 +74,9 @@ public class HpackEncoder
|
|||
|
||||
|
||||
private final static EnumSet<HttpHeader> __NEVER_INDEX =
|
||||
EnumSet.of(HttpHeader.SET_COOKIE,
|
||||
EnumSet.of(
|
||||
HttpHeader.AUTHORIZATION,
|
||||
HttpHeader.SET_COOKIE,
|
||||
HttpHeader.SET_COOKIE2);
|
||||
|
||||
static
|
||||
|
|
Loading…
Reference in New Issue