Merge branch 'jetty-9.4.x' into jetty-9.4.x-ewyk
This commit is contained in:
commit
69003d3dd9
|
@ -13,7 +13,7 @@
|
||||||
<name>Jetty :: GCloud</name>
|
<name>Jetty :: GCloud</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<gcloud.version>0.9.4-beta</gcloud.version>
|
<gcloud.version>0.10.0-beta</gcloud.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class HttpStatus
|
||||||
public final static int REQUESTED_RANGE_NOT_SATISFIABLE_416 = 416;
|
public final static int REQUESTED_RANGE_NOT_SATISFIABLE_416 = 416;
|
||||||
public final static int RANGE_NOT_SATISFIABLE_416 = 416;
|
public final static int RANGE_NOT_SATISFIABLE_416 = 416;
|
||||||
public final static int EXPECTATION_FAILED_417 = 417;
|
public final static int EXPECTATION_FAILED_417 = 417;
|
||||||
public final static int IM_A_TEAPOT_418 = 417;
|
public final static int IM_A_TEAPOT_418 = 418;
|
||||||
public final static int ENHANCE_YOUR_CALM_420 = 420;
|
public final static int ENHANCE_YOUR_CALM_420 = 420;
|
||||||
public final static int MISDIRECTED_REQUEST_421 = 421;
|
public final static int MISDIRECTED_REQUEST_421 = 421;
|
||||||
public final static int UNPROCESSABLE_ENTITY_422 = 422;
|
public final static int UNPROCESSABLE_ENTITY_422 = 422;
|
||||||
|
@ -153,7 +153,7 @@ public class HttpStatus
|
||||||
UNSUPPORTED_MEDIA_TYPE(UNSUPPORTED_MEDIA_TYPE_415, "Unsupported Media Type"),
|
UNSUPPORTED_MEDIA_TYPE(UNSUPPORTED_MEDIA_TYPE_415, "Unsupported Media Type"),
|
||||||
RANGE_NOT_SATISFIABLE(RANGE_NOT_SATISFIABLE_416, "Range Not Satisfiable"),
|
RANGE_NOT_SATISFIABLE(RANGE_NOT_SATISFIABLE_416, "Range Not Satisfiable"),
|
||||||
EXPECTATION_FAILED(EXPECTATION_FAILED_417, "Expectation Failed"),
|
EXPECTATION_FAILED(EXPECTATION_FAILED_417, "Expectation Failed"),
|
||||||
IM_A_TEAPOT(IM_A_TEAPOT_418, "Im a Teapot"),
|
IM_A_TEAPOT(IM_A_TEAPOT_418, "I'm a Teapot"),
|
||||||
ENHANCE_YOUR_CALM(ENHANCE_YOUR_CALM_420, "Enhance your Calm"),
|
ENHANCE_YOUR_CALM(ENHANCE_YOUR_CALM_420, "Enhance your Calm"),
|
||||||
MISDIRECTED_REQUEST(MISDIRECTED_REQUEST_421, "Misdirected Request"),
|
MISDIRECTED_REQUEST(MISDIRECTED_REQUEST_421, "Misdirected Request"),
|
||||||
UNPROCESSABLE_ENTITY(UNPROCESSABLE_ENTITY_422, "Unprocessable Entity"),
|
UNPROCESSABLE_ENTITY(UNPROCESSABLE_ENTITY_422, "Unprocessable Entity"),
|
||||||
|
|
|
@ -31,6 +31,14 @@ public class HttpStatusCodeTest
|
||||||
assertNull("Invalid code: 800", HttpStatus.getCode(800));
|
assertNull("Invalid code: 800", HttpStatus.getCode(800));
|
||||||
assertNull("Invalid code: 190", HttpStatus.getCode(190));
|
assertNull("Invalid code: 190", HttpStatus.getCode(190));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testImATeapot()
|
||||||
|
{
|
||||||
|
assertEquals("I'm a Teapot", HttpStatus.getMessage(418));
|
||||||
|
assertEquals("Expectation Failed", HttpStatus.getMessage(417));
|
||||||
|
}
|
||||||
|
|
||||||
public void testHttpMethod()
|
public void testHttpMethod()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,54 +12,52 @@
|
||||||
<Call name="insertHandler">
|
<Call name="insertHandler">
|
||||||
<Arg>
|
<Arg>
|
||||||
<New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
|
<New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
|
||||||
<Set name="minGzipSize"><Property name="jetty.gzip.minGzipSize" deprecated="gzip.minGzipSize" default="2048"/></Set>
|
<Set name="minGzipSize"><Property name="jetty.gzip.minGzipSize" deprecated="gzip.minGzipSize" default="2048"/></Set>
|
||||||
<Set name="checkGzExists"><Property name="jetty.gzip.checkGzExists" deprecated="gzip.checkGzExists" default="false"/></Set>
|
<Set name="checkGzExists"><Property name="jetty.gzip.checkGzExists" deprecated="gzip.checkGzExists" default="false"/></Set>
|
||||||
<Set name="compressionLevel"><Property name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" default="-1"/></Set>
|
<Set name="compressionLevel"><Property name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" default="-1"/></Set>
|
||||||
<Set name="inflateBufferSize"><Property name="jetty.gzip.inflateBufferSize" default="0"/></Set>
|
<Set name="inflateBufferSize"><Property name="jetty.gzip.inflateBufferSize" default="0"/></Set>
|
||||||
|
<Set name="syncFlush"><Property name="jetty.gzip.syncFlush" default="false" /></Set>
|
||||||
|
|
||||||
<Set name="excludedAgentPatterns">
|
<Set name="excludedAgentPatterns">
|
||||||
<Array type="String">
|
<Array type="String">
|
||||||
<Item><Property name="jetty.gzip.excludedUserAgent" deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/></Item>
|
<Item><Property name="jetty.gzip.excludedUserAgent" deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/></Item>
|
||||||
</Array>
|
</Array>
|
||||||
</Set>
|
</Set>
|
||||||
|
|
||||||
<Set name="includedMethods">
|
<Set name="includedMethodList"><Property name="jetty.gzip.includedMethodList" default="GET" /></Set>
|
||||||
<Array type="String">
|
<Set name="excludedMethodList"><Property name="jetty.gzip.excludedMethodList" default="" /></Set>
|
||||||
<Item>GET</Item>
|
|
||||||
</Array>
|
|
||||||
</Set>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<Set name="includedPaths">
|
<Set name="includedMethods">
|
||||||
<Array type="String">
|
<Array type="String">
|
||||||
<Item>/*</Item>
|
<Item>GET</Item>
|
||||||
</Array>
|
</Array>
|
||||||
</Set>
|
</Set>
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<Set name="includedPaths">
|
||||||
<Set name="excludedPaths">
|
<Array type="String">
|
||||||
<Array type="String">
|
<Item>/*</Item>
|
||||||
<Item>*.gz</Item>
|
</Array>
|
||||||
</Array>
|
</Set>
|
||||||
</Set>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<Set name="excludedPaths">
|
||||||
<Call name="addIncludedMimeTypes">
|
<Array type="String">
|
||||||
<Arg><Array type="String">
|
<Item>*.gz</Item>
|
||||||
<Item>some/type</Item>
|
</Array>
|
||||||
</Array></Arg>
|
</Set>
|
||||||
</Call>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<Call name="addIncludedMimeTypes">
|
||||||
<Call name="addExcludedMimeTypes">
|
<Arg><Array type="String">
|
||||||
<Arg><Array type="String">
|
<Item>some/type</Item>
|
||||||
<Item>some/type</Item>
|
</Array></Arg>
|
||||||
</Array></Arg>
|
</Call>
|
||||||
</Call>
|
|
||||||
-->
|
<Call name="addExcludedMimeTypes">
|
||||||
|
<Arg><Array type="String">
|
||||||
|
<Item>some/type</Item>
|
||||||
|
</Array></Arg>
|
||||||
|
</Call>
|
||||||
|
-->
|
||||||
|
|
||||||
</New>
|
</New>
|
||||||
</Arg>
|
</Arg>
|
||||||
|
|
|
@ -26,3 +26,9 @@ etc/jetty-gzip.xml
|
||||||
|
|
||||||
## Inflate request buffer size, or 0 for no request inflation
|
## Inflate request buffer size, or 0 for no request inflation
|
||||||
# jetty.gzip.inflateBufferSize=0
|
# jetty.gzip.inflateBufferSize=0
|
||||||
|
|
||||||
|
## Comma separated list of included methods
|
||||||
|
# jetty.gzip.includedMethodList=GET
|
||||||
|
|
||||||
|
## Comma separated list of excluded methods
|
||||||
|
# jetty.gzip.excludedMethodList=
|
||||||
|
|
|
@ -129,7 +129,7 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
* <li>call the {@link #getDefaultConnectionFactory()} {@link ConnectionFactory#newConnection(Connector, org.eclipse.jetty.io.EndPoint)}
|
* <li>call the {@link #getDefaultConnectionFactory()} {@link ConnectionFactory#newConnection(Connector, org.eclipse.jetty.io.EndPoint)}
|
||||||
* method to create a new Connection instance.</li>
|
* method to create a new Connection instance.</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
* The default number of acceptor tasks is the minimum of 1 and half the number of available CPUs. Having more acceptors may reduce
|
* The default number of acceptor tasks is the minimum of 1 and the number of available CPUs divided by 8. Having more acceptors may reduce
|
||||||
* the latency for servers that see a high rate of new connections (eg HTTP/1.0 without keep-alive). Typically the default is
|
* the latency for servers that see a high rate of new connections (eg HTTP/1.0 without keep-alive). Typically the default is
|
||||||
* sufficient for modern persistent protocols (HTTP/1.1, HTTP/2 etc.)
|
* sufficient for modern persistent protocols (HTTP/1.1, HTTP/2 etc.)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -225,28 +225,53 @@ public class Dispatcher implements RequestDispatcher
|
||||||
return String.format("Dispatcher@0x%x{%s,%s}",hashCode(),_named,_uri);
|
return String.format("Dispatcher@0x%x{%s,%s}",hashCode(),_named,_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void commitResponse(ServletResponse response, Request baseRequest) throws IOException
|
@SuppressWarnings("Duplicates")
|
||||||
|
private void commitResponse(ServletResponse response, Request baseRequest) throws IOException, ServletException
|
||||||
{
|
{
|
||||||
if (baseRequest.getResponse().isWriting())
|
if (baseRequest.getResponse().isWriting())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Try closing Writer first (based on knowledge in Response obj)
|
||||||
response.getWriter().close();
|
response.getWriter().close();
|
||||||
}
|
}
|
||||||
catch (IllegalStateException e)
|
catch (IllegalStateException e1)
|
||||||
{
|
{
|
||||||
response.getOutputStream().close();
|
try
|
||||||
|
{
|
||||||
|
// Try closing OutputStream as alternate route
|
||||||
|
// This path is possible due to badly behaving Response wrappers
|
||||||
|
response.getOutputStream().close();
|
||||||
|
}
|
||||||
|
catch(IllegalStateException e2)
|
||||||
|
{
|
||||||
|
ServletException servletException = new ServletException("Unable to commit the response", e2);
|
||||||
|
servletException.addSuppressed(e1);
|
||||||
|
throw servletException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Try closing OutputStream first (based on knowledge in Response obj)
|
||||||
response.getOutputStream().close();
|
response.getOutputStream().close();
|
||||||
}
|
}
|
||||||
catch (IllegalStateException e)
|
catch (IllegalStateException e1)
|
||||||
{
|
{
|
||||||
response.getWriter().close();
|
try
|
||||||
|
{
|
||||||
|
// Try closing Writer as alternate route
|
||||||
|
// This path is possible due to badly behaving Response wrappers
|
||||||
|
response.getWriter().close();
|
||||||
|
}
|
||||||
|
catch(IllegalStateException e2)
|
||||||
|
{
|
||||||
|
ServletException servletException = new ServletException("Unable to commit the response", e2);
|
||||||
|
servletException.addSuppressed(e1);
|
||||||
|
throw servletException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ public class Response implements HttpServletResponse
|
||||||
|
|
||||||
private enum EncodingFrom { NOT_SET, INFERRED, SET_LOCALE, SET_CONTENT_TYPE, SET_CHARACTER_ENCODING };
|
private enum EncodingFrom { NOT_SET, INFERRED, SET_LOCALE, SET_CONTENT_TYPE, SET_CHARACTER_ENCODING };
|
||||||
private static final EnumSet<EncodingFrom> __localeOverride = EnumSet.of(EncodingFrom.NOT_SET,EncodingFrom.INFERRED);
|
private static final EnumSet<EncodingFrom> __localeOverride = EnumSet.of(EncodingFrom.NOT_SET,EncodingFrom.INFERRED);
|
||||||
|
private static final EnumSet<EncodingFrom> __explicitCharset = EnumSet.of(EncodingFrom.SET_LOCALE,EncodingFrom.SET_CHARACTER_ENCODING);
|
||||||
|
|
||||||
|
|
||||||
public Response(HttpChannel channel, HttpOutput out)
|
public Response(HttpChannel channel, HttpOutput out)
|
||||||
|
@ -1425,10 +1426,19 @@ public class Response implements HttpServletResponse
|
||||||
HttpField ct=content.getContentType();
|
HttpField ct=content.getContentType();
|
||||||
if (ct!=null)
|
if (ct!=null)
|
||||||
{
|
{
|
||||||
_fields.put(ct);
|
if (_characterEncoding!=null &&
|
||||||
_contentType=ct.getValue();
|
content.getCharacterEncoding()==null &&
|
||||||
_characterEncoding=content.getCharacterEncoding();
|
__explicitCharset.contains(_encodingFrom))
|
||||||
_mimeType=content.getMimeType();
|
{
|
||||||
|
setContentType(content.getMimeType().getBaseType().asString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_fields.put(ct);
|
||||||
|
_contentType=ct.getValue();
|
||||||
|
_characterEncoding=content.getCharacterEncoding();
|
||||||
|
_mimeType=content.getMimeType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpField ce=content.getContentEncoding();
|
HttpField ce=content.getContentEncoding();
|
||||||
|
|
|
@ -71,7 +71,7 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
* that these callbacks may do some non-blocking IO work, but will always dispatch to the
|
* that these callbacks may do some non-blocking IO work, but will always dispatch to the
|
||||||
* {@link Executor} service any blocking, long running or application tasks.
|
* {@link Executor} service any blocking, long running or application tasks.
|
||||||
* <p>
|
* <p>
|
||||||
* The default number of selectors is equal to the number of processors available to the JVM,
|
* The default number of selectors is equal to half of the number of processors available to the JVM,
|
||||||
* which should allow optimal performance even if all the connections used are performing
|
* which should allow optimal performance even if all the connections used are performing
|
||||||
* significant non-blocking work in the callback tasks.
|
* significant non-blocking work in the callback tasks.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
private final CopyOnWriteArrayList<AliasCheck> _aliasChecks = new CopyOnWriteArrayList<ContextHandler.AliasCheck>();
|
private final CopyOnWriteArrayList<AliasCheck> _aliasChecks = new CopyOnWriteArrayList<ContextHandler.AliasCheck>();
|
||||||
|
|
||||||
public enum Availability { UNAVAILABLE,STARTING,AVAILABLE,SHUTDOWN,};
|
public enum Availability { UNAVAILABLE,STARTING,AVAILABLE,SHUTDOWN,};
|
||||||
private volatile Availability _availability;
|
private volatile Availability _availability = Availability.UNAVAILABLE;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public ContextHandler()
|
public ContextHandler()
|
||||||
|
@ -684,18 +684,12 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @return true if this context is accepting new requests
|
* @return true if this context is shutting down
|
||||||
*/
|
*/
|
||||||
@ManagedAttribute("true for graceful shutdown, which allows existing requests to complete")
|
@ManagedAttribute("true for graceful shutdown, which allows existing requests to complete")
|
||||||
public boolean isShutdown()
|
public boolean isShutdown()
|
||||||
{
|
{
|
||||||
switch(_availability)
|
return _availability == Availability.SHUTDOWN;
|
||||||
{
|
|
||||||
case SHUTDOWN:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -59,31 +59,25 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
*/
|
*/
|
||||||
public class GzipHandler extends HandlerWrapper implements GzipFactory
|
public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
{
|
{
|
||||||
|
public static final String GZIP = "gzip";
|
||||||
|
public static final String DEFLATE = "deflate";
|
||||||
|
public static final int DEFAULT_MIN_GZIP_SIZE=16;
|
||||||
private static final Logger LOG = Log.getLogger(GzipHandler.class);
|
private static final Logger LOG = Log.getLogger(GzipHandler.class);
|
||||||
|
|
||||||
public final static String GZIP = "gzip";
|
|
||||||
public final static String DEFLATE = "deflate";
|
|
||||||
public final static int DEFAULT_MIN_GZIP_SIZE=16;
|
|
||||||
private int _minGzipSize=DEFAULT_MIN_GZIP_SIZE;
|
private int _minGzipSize=DEFAULT_MIN_GZIP_SIZE;
|
||||||
private int _compressionLevel=Deflater.DEFAULT_COMPRESSION;
|
private int _compressionLevel=Deflater.DEFAULT_COMPRESSION;
|
||||||
private boolean _checkGzExists = true;
|
private boolean _checkGzExists = true;
|
||||||
private boolean _syncFlush = false;
|
private boolean _syncFlush = false;
|
||||||
private int _inflateBufferSize = -1;
|
private int _inflateBufferSize = -1;
|
||||||
private EnumSet<DispatcherType> _dispatchers = EnumSet.of(DispatcherType.REQUEST);
|
private EnumSet<DispatcherType> _dispatchers = EnumSet.of(DispatcherType.REQUEST);
|
||||||
|
|
||||||
// non-static, as other GzipHandler instances may have different configurations
|
// non-static, as other GzipHandler instances may have different configurations
|
||||||
private final ThreadLocal<Deflater> _deflater = new ThreadLocal<>();
|
private final ThreadLocal<Deflater> _deflater = new ThreadLocal<>();
|
||||||
|
|
||||||
private final IncludeExclude<String> _agentPatterns=new IncludeExclude<>(RegexSet.class);
|
private final IncludeExclude<String> _agentPatterns=new IncludeExclude<>(RegexSet.class);
|
||||||
private final IncludeExclude<String> _methods = new IncludeExclude<>();
|
private final IncludeExclude<String> _methods = new IncludeExclude<>();
|
||||||
private final IncludeExclude<String> _paths = new IncludeExclude<>(PathSpecSet.class);
|
private final IncludeExclude<String> _paths = new IncludeExclude<>(PathSpecSet.class);
|
||||||
private final IncludeExclude<String> _mimeTypes = new IncludeExclude<>();
|
private final IncludeExclude<String> _mimeTypes = new IncludeExclude<>();
|
||||||
|
|
||||||
private HttpField _vary;
|
private HttpField _vary;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new gzip handler.
|
* Instantiates a new gzip handler.
|
||||||
* The excluded Mime Types are initialized to common known
|
* The excluded Mime Types are initialized to common known
|
||||||
|
@ -110,12 +104,13 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_mimeTypes.exclude("application/brotli");
|
_mimeTypes.exclude("application/brotli");
|
||||||
_mimeTypes.exclude("application/x-xz");
|
_mimeTypes.exclude("application/x-xz");
|
||||||
_mimeTypes.exclude("application/x-rar-compressed");
|
_mimeTypes.exclude("application/x-rar-compressed");
|
||||||
LOG.debug("{} mime types {}",this,_mimeTypes);
|
|
||||||
|
if (LOG.isDebugEnabled())
|
||||||
|
LOG.debug("{} mime types {}",this,_mimeTypes);
|
||||||
|
|
||||||
_agentPatterns.exclude(".*MSIE 6.0.*");
|
_agentPatterns.exclude(".*MSIE 6.0.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param patterns Regular expressions matching user agents to exclude
|
* @param patterns Regular expressions matching user agents to exclude
|
||||||
*/
|
*/
|
||||||
|
@ -124,7 +119,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_agentPatterns.exclude(patterns);
|
_agentPatterns.exclude(patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param methods The methods to exclude in compression
|
* @param methods The methods to exclude in compression
|
||||||
*/
|
*/
|
||||||
|
@ -134,28 +128,24 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_methods.exclude(m);
|
_methods.exclude(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public EnumSet<DispatcherType> getDispatcherTypes()
|
public EnumSet<DispatcherType> getDispatcherTypes()
|
||||||
{
|
{
|
||||||
return _dispatchers;
|
return _dispatchers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public void setDispatcherTypes(EnumSet<DispatcherType> dispatchers)
|
public void setDispatcherTypes(EnumSet<DispatcherType> dispatchers)
|
||||||
{
|
{
|
||||||
_dispatchers = dispatchers;
|
_dispatchers = dispatchers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public void setDispatcherTypes(DispatcherType... dispatchers)
|
public void setDispatcherTypes(DispatcherType... dispatchers)
|
||||||
{
|
{
|
||||||
_dispatchers = EnumSet.copyOf(Arrays.asList(dispatchers));
|
_dispatchers = EnumSet.copyOf(Arrays.asList(dispatchers));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Set the mime types.
|
* Adds mime types to the excluded list.
|
||||||
|
*
|
||||||
* @param types The mime types to exclude (without charset or other parameters).
|
* @param types The mime types to exclude (without charset or other parameters).
|
||||||
* For backward compatibility the mimetypes may be comma separated strings, but this
|
* For backward compatibility the mimetypes may be comma separated strings, but this
|
||||||
* will not be supported in future versions.
|
* will not be supported in future versions.
|
||||||
|
@ -166,9 +156,8 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_mimeTypes.exclude(StringUtil.csvSplit(t));
|
_mimeTypes.exclude(StringUtil.csvSplit(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Add path to excluded paths list.
|
* Add paths to excluded paths list.
|
||||||
* <p>
|
* <p>
|
||||||
* There are 2 syntaxes supported, Servlet <code>url-pattern</code> based, and
|
* There are 2 syntaxes supported, Servlet <code>url-pattern</code> based, and
|
||||||
* Regex based. This means that the initial characters on the path spec
|
* Regex based. This means that the initial characters on the path spec
|
||||||
|
@ -198,16 +187,14 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_paths.exclude(StringUtil.csvSplit(p));
|
_paths.exclude(StringUtil.csvSplit(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param patterns Regular expressions matching user agents to exclude
|
* @param patterns Regular expressions matching user agents to include
|
||||||
*/
|
*/
|
||||||
public void addIncludedAgentPatterns(String... patterns)
|
public void addIncludedAgentPatterns(String... patterns)
|
||||||
{
|
{
|
||||||
_agentPatterns.include(patterns);
|
_agentPatterns.include(patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param methods The methods to include in compression
|
* @param methods The methods to include in compression
|
||||||
*/
|
*/
|
||||||
|
@ -217,7 +204,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_methods.include(m);
|
_methods.include(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @return True if {@link Deflater#SYNC_FLUSH} is used, else {@link Deflater#NO_FLUSH}
|
* @return True if {@link Deflater#SYNC_FLUSH} is used, else {@link Deflater#NO_FLUSH}
|
||||||
*/
|
*/
|
||||||
|
@ -226,7 +212,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
return _syncFlush;
|
return _syncFlush;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* <p>Set the {@link Deflater} flush mode to use. {@link Deflater#SYNC_FLUSH}
|
* <p>Set the {@link Deflater} flush mode to use. {@link Deflater#SYNC_FLUSH}
|
||||||
* should be used if the application wishes to stream the data, but this may
|
* should be used if the application wishes to stream the data, but this may
|
||||||
|
@ -238,7 +223,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_syncFlush = syncFlush;
|
_syncFlush = syncFlush;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Add included mime types. Inclusion takes precedence over
|
* Add included mime types. Inclusion takes precedence over
|
||||||
* exclusion.
|
* exclusion.
|
||||||
|
@ -252,9 +236,8 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_mimeTypes.include(StringUtil.csvSplit(t));
|
_mimeTypes.include(StringUtil.csvSplit(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Add path specs to include.
|
* Adds paths specs to the included list.
|
||||||
* <p>
|
* <p>
|
||||||
* There are 2 syntaxes supported, Servlet <code>url-pattern</code> based, and
|
* There are 2 syntaxes supported, Servlet <code>url-pattern</code> based, and
|
||||||
* Regex based. This means that the initial characters on the path spec
|
* Regex based. This means that the initial characters on the path spec
|
||||||
|
@ -270,7 +253,7 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
* <li>All other syntaxes are unsupported</li>
|
* <li>All other syntaxes are unsupported</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
* Note: inclusion takes precedence over exclude.
|
* Note: inclusion takes precedence over exclusion.
|
||||||
*
|
*
|
||||||
* @param pathspecs Path specs (as per servlet spec) to include. If a
|
* @param pathspecs Path specs (as per servlet spec) to include. If a
|
||||||
* ServletContext is available, the paths are relative to the context path,
|
* ServletContext is available, the paths are relative to the context path,
|
||||||
|
@ -282,7 +265,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_paths.include(StringUtil.csvSplit(p));
|
_paths.include(StringUtil.csvSplit(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws Exception
|
protected void doStart() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -290,19 +272,16 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
super.doStart();
|
super.doStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public boolean getCheckGzExists()
|
public boolean getCheckGzExists()
|
||||||
{
|
{
|
||||||
return _checkGzExists;
|
return _checkGzExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public int getCompressionLevel()
|
public int getCompressionLevel()
|
||||||
{
|
{
|
||||||
return _compressionLevel;
|
return _compressionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
@Override
|
@Override
|
||||||
public Deflater getDeflater(Request request, long content_length)
|
public Deflater getDeflater(Request request, long content_length)
|
||||||
{
|
{
|
||||||
|
@ -344,87 +323,73 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
return df;
|
return df;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getExcludedAgentPatterns()
|
public String[] getExcludedAgentPatterns()
|
||||||
{
|
{
|
||||||
Set<String> excluded=_agentPatterns.getExcluded();
|
Set<String> excluded=_agentPatterns.getExcluded();
|
||||||
return excluded.toArray(new String[excluded.size()]);
|
return excluded.toArray(new String[excluded.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getExcludedMethods()
|
public String[] getExcludedMethods()
|
||||||
{
|
{
|
||||||
Set<String> excluded=_methods.getExcluded();
|
Set<String> excluded=_methods.getExcluded();
|
||||||
return excluded.toArray(new String[excluded.size()]);
|
return excluded.toArray(new String[excluded.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getExcludedMimeTypes()
|
public String[] getExcludedMimeTypes()
|
||||||
{
|
{
|
||||||
Set<String> excluded=_mimeTypes.getExcluded();
|
Set<String> excluded=_mimeTypes.getExcluded();
|
||||||
return excluded.toArray(new String[excluded.size()]);
|
return excluded.toArray(new String[excluded.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getExcludedPaths()
|
public String[] getExcludedPaths()
|
||||||
{
|
{
|
||||||
Set<String> excluded=_paths.getExcluded();
|
Set<String> excluded=_paths.getExcluded();
|
||||||
return excluded.toArray(new String[excluded.size()]);
|
return excluded.toArray(new String[excluded.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getIncludedAgentPatterns()
|
public String[] getIncludedAgentPatterns()
|
||||||
{
|
{
|
||||||
Set<String> includes=_agentPatterns.getIncluded();
|
Set<String> includes=_agentPatterns.getIncluded();
|
||||||
return includes.toArray(new String[includes.size()]);
|
return includes.toArray(new String[includes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getIncludedMethods()
|
public String[] getIncludedMethods()
|
||||||
{
|
{
|
||||||
Set<String> includes=_methods.getIncluded();
|
Set<String> includes=_methods.getIncluded();
|
||||||
return includes.toArray(new String[includes.size()]);
|
return includes.toArray(new String[includes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getIncludedMimeTypes()
|
public String[] getIncludedMimeTypes()
|
||||||
{
|
{
|
||||||
Set<String> includes=_mimeTypes.getIncluded();
|
Set<String> includes=_mimeTypes.getIncluded();
|
||||||
return includes.toArray(new String[includes.size()]);
|
return includes.toArray(new String[includes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
public String[] getIncludedPaths()
|
public String[] getIncludedPaths()
|
||||||
{
|
{
|
||||||
Set<String> includes=_paths.getIncluded();
|
Set<String> includes=_paths.getIncluded();
|
||||||
return includes.toArray(new String[includes.size()]);
|
return includes.toArray(new String[includes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String[] getMethods()
|
public String[] getMethods()
|
||||||
{
|
{
|
||||||
return getIncludedMethods();
|
return getIncludedMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum response size.
|
* @return minimum response size that triggers compression
|
||||||
*
|
|
||||||
* @return minimum response size
|
|
||||||
*/
|
*/
|
||||||
public int getMinGzipSize()
|
public int getMinGzipSize()
|
||||||
{
|
{
|
||||||
return _minGzipSize;
|
return _minGzipSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
protected HttpField getVaryField()
|
protected HttpField getVaryField()
|
||||||
{
|
{
|
||||||
return _vary;
|
return _vary;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @return size in bytes of the buffer to inflate compressed request, or 0 for no inflation.
|
* @return size in bytes of the buffer to inflate compressed request, or 0 for no inflation.
|
||||||
*/
|
*/
|
||||||
|
@ -433,7 +398,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
return _inflateBufferSize;
|
return _inflateBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param size size in bytes of the buffer to inflate compressed request, or 0 for no inflation.
|
* @param size size in bytes of the buffer to inflate compressed request, or 0 for no inflation.
|
||||||
*/
|
*/
|
||||||
|
@ -442,10 +406,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_inflateBufferSize = size;
|
_inflateBufferSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||||
{
|
{
|
||||||
|
@ -568,12 +528,9 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if the userAgent is excluded
|
|
||||||
*
|
|
||||||
* @param ua the user agent
|
* @param ua the user agent
|
||||||
* @return boolean true if excluded
|
* @return whether compressing is allowed for the given user agent
|
||||||
*/
|
*/
|
||||||
protected boolean isAgentGzipable(String ua)
|
protected boolean isAgentGzipable(String ua)
|
||||||
{
|
{
|
||||||
|
@ -583,20 +540,15 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
return _agentPatterns.test(ua);
|
return _agentPatterns.test(ua);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMimeTypeGzipable(String mimetype)
|
public boolean isMimeTypeGzipable(String mimetype)
|
||||||
{
|
{
|
||||||
return _mimeTypes.test(mimetype);
|
return _mimeTypes.test(mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if the path is included or not excluded
|
* @param requestURI the request uri
|
||||||
*
|
* @return whether compressing is allowed for the given the path
|
||||||
* @param requestURI
|
|
||||||
* the request uri
|
|
||||||
* @return boolean true if gzipable
|
|
||||||
*/
|
*/
|
||||||
protected boolean isPathGzipable(String requestURI)
|
protected boolean isPathGzipable(String requestURI)
|
||||||
{
|
{
|
||||||
|
@ -606,7 +558,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
return _paths.test(requestURI);
|
return _paths.test(requestURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
@Override
|
@Override
|
||||||
public void recycle(Deflater deflater)
|
public void recycle(Deflater deflater)
|
||||||
{
|
{
|
||||||
|
@ -615,9 +566,8 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_deflater.set(deflater);
|
_deflater.set(deflater);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param checkGzExists If true, check if a static gz file exists for
|
* @param checkGzExists whether to check if a static gz file exists for
|
||||||
* the resource that the DefaultServlet may serve as precompressed.
|
* the resource that the DefaultServlet may serve as precompressed.
|
||||||
*/
|
*/
|
||||||
public void setCheckGzExists(boolean checkGzExists)
|
public void setCheckGzExists(boolean checkGzExists)
|
||||||
|
@ -625,7 +575,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_checkGzExists = checkGzExists;
|
_checkGzExists = checkGzExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param compressionLevel The compression level to use to initialize {@link Deflater#setLevel(int)}
|
* @param compressionLevel The compression level to use to initialize {@link Deflater#setLevel(int)}
|
||||||
*/
|
*/
|
||||||
|
@ -634,7 +583,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_compressionLevel = compressionLevel;
|
_compressionLevel = compressionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param patterns Regular expressions matching user agents to exclude
|
* @param patterns Regular expressions matching user agents to exclude
|
||||||
*/
|
*/
|
||||||
|
@ -644,19 +592,16 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
addExcludedAgentPatterns(patterns);
|
addExcludedAgentPatterns(patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param method to exclude
|
* @param methods the HTTP methods to exclude
|
||||||
*/
|
*/
|
||||||
public void setExcludedMethods(String... method)
|
public void setExcludedMethods(String... methods)
|
||||||
{
|
{
|
||||||
_methods.getExcluded().clear();
|
_methods.getExcluded().clear();
|
||||||
_methods.exclude(method);
|
_methods.exclude(methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Set the mime types.
|
|
||||||
* @param types The mime types to exclude (without charset or other parameters)
|
* @param types The mime types to exclude (without charset or other parameters)
|
||||||
*/
|
*/
|
||||||
public void setExcludedMimeTypes(String... types)
|
public void setExcludedMimeTypes(String... types)
|
||||||
|
@ -665,7 +610,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_mimeTypes.exclude(types);
|
_mimeTypes.exclude(types);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param pathspecs Path specs (as per servlet spec) to exclude. If a
|
* @param pathspecs Path specs (as per servlet spec) to exclude. If a
|
||||||
* ServletContext is available, the paths are relative to the context path,
|
* ServletContext is available, the paths are relative to the context path,
|
||||||
|
@ -677,7 +621,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_paths.exclude(pathspecs);
|
_paths.exclude(pathspecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param patterns Regular expressions matching user agents to include
|
* @param patterns Regular expressions matching user agents to include
|
||||||
*/
|
*/
|
||||||
|
@ -687,7 +630,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
addIncludedAgentPatterns(patterns);
|
addIncludedAgentPatterns(patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* @param methods The methods to include in compression
|
* @param methods The methods to include in compression
|
||||||
*/
|
*/
|
||||||
|
@ -697,10 +639,9 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_methods.include(methods);
|
_methods.include(methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Set included mime types. Inclusion takes precedence over
|
* Sets included mime types. Inclusion takes precedence over exclusion.
|
||||||
* exclusion.
|
*
|
||||||
* @param types The mime types to include (without charset or other parameters)
|
* @param types The mime types to include (without charset or other parameters)
|
||||||
*/
|
*/
|
||||||
public void setIncludedMimeTypes(String... types)
|
public void setIncludedMimeTypes(String... types)
|
||||||
|
@ -709,9 +650,9 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_mimeTypes.include(types);
|
_mimeTypes.include(types);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Set the path specs to include. Inclusion takes precedence over exclusion.
|
* Set the path specs to include. Inclusion takes precedence over exclusion.
|
||||||
|
*
|
||||||
* @param pathspecs Path specs (as per servlet spec) to include. If a
|
* @param pathspecs Path specs (as per servlet spec) to include. If a
|
||||||
* ServletContext is available, the paths are relative to the context path,
|
* ServletContext is available, the paths are relative to the context path,
|
||||||
* otherwise they are absolute
|
* otherwise they are absolute
|
||||||
|
@ -722,9 +663,8 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
_paths.include(pathspecs);
|
_paths.include(pathspecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Set the minimum response size to trigger dynamic compresssion
|
* Set the minimum response size to trigger dynamic compression
|
||||||
*
|
*
|
||||||
* @param minGzipSize minimum response size in bytes
|
* @param minGzipSize minimum response size in bytes
|
||||||
*/
|
*/
|
||||||
|
@ -732,4 +672,24 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
|
||||||
{
|
{
|
||||||
_minGzipSize = minGzipSize;
|
_minGzipSize = minGzipSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIncludedMethodList(String csvMethods)
|
||||||
|
{
|
||||||
|
setIncludedMethods(StringUtil.csvSplit(csvMethods));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIncludedMethodList()
|
||||||
|
{
|
||||||
|
return String.join(",", getIncludedMethods());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExcludedMethodList(String csvMethods)
|
||||||
|
{
|
||||||
|
setExcludedMethods(StringUtil.csvSplit(csvMethods));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExcludedMethodList()
|
||||||
|
{
|
||||||
|
return String.join(",", getExcludedMethods());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,11 @@ public class ContextHandlerTest
|
||||||
Assert.assertTrue(handler.isProtectedTarget("/ABC/7777"));
|
Assert.assertTrue(handler.isProtectedTarget("/ABC/7777"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsShutdown() {
|
||||||
|
ContextHandler handler = new ContextHandler();
|
||||||
|
Assert.assertEquals(false, handler.isShutdown());
|
||||||
|
}
|
||||||
|
|
||||||
private void checkResourcePathsForExampleWebApp(String root) throws IOException
|
private void checkResourcePathsForExampleWebApp(String root) throws IOException
|
||||||
{
|
{
|
||||||
|
|
|
@ -729,6 +729,8 @@ public class DefaultServletTest
|
||||||
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\n\r\n");
|
String response = connector.getResponse("GET /context/data0.txt HTTP/1.0\r\n\r\n");
|
||||||
assertResponseContains("Content-Length: 12", response);
|
assertResponseContains("Content-Length: 12", response);
|
||||||
assertResponseNotContains("Extra Info", response);
|
assertResponseNotContains("Extra Info", response);
|
||||||
|
assertResponseContains("Content-Type: text/plain", response);
|
||||||
|
assertResponseNotContains("Content-Type: text/plain;charset=utf-8", response);
|
||||||
|
|
||||||
server.stop();
|
server.stop();
|
||||||
context.addFilter(OutputFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
|
context.addFilter(OutputFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
|
||||||
|
@ -738,6 +740,7 @@ public class DefaultServletTest
|
||||||
assertResponseContains("Content-Length: 2", response); // 20 something long
|
assertResponseContains("Content-Length: 2", response); // 20 something long
|
||||||
assertResponseContains("Extra Info", response);
|
assertResponseContains("Extra Info", response);
|
||||||
assertResponseNotContains("Content-Length: 12", response);
|
assertResponseNotContains("Content-Length: 12", response);
|
||||||
|
assertResponseContains("Content-Type: text/plain;charset=utf-8", response);
|
||||||
|
|
||||||
server.stop();
|
server.stop();
|
||||||
context.getServletHandler().setFilterMappings(new FilterMapping[]{});
|
context.getServletHandler().setFilterMappings(new FilterMapping[]{});
|
||||||
|
@ -1226,6 +1229,7 @@ public class DefaultServletTest
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
|
||||||
{
|
{
|
||||||
response.getOutputStream().println("Extra Info");
|
response.getOutputStream().println("Extra Info");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,8 @@ public class GCloudSessionTestSupport
|
||||||
|
|
||||||
public GCloudSessionTestSupport ()
|
public GCloudSessionTestSupport ()
|
||||||
{
|
{
|
||||||
DatastoreOptions options = _helper.options();
|
DatastoreOptions options = _helper.getOptions();
|
||||||
_ds = options.service();
|
_ds = options.getService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ public class GCloudSessionTestSupport
|
||||||
public Set<String> getSessionIds () throws Exception
|
public Set<String> getSessionIds () throws Exception
|
||||||
{
|
{
|
||||||
HashSet<String> ids = new HashSet<String>();
|
HashSet<String> ids = new HashSet<String>();
|
||||||
GqlQuery.Builder builder = Query.gqlQueryBuilder(ResultType.ENTITY, "select * from "+GCloudSessionDataStore.EntityDataModel.KIND);
|
GqlQuery.Builder builder = Query.newGqlQueryBuilder(ResultType.ENTITY, "select * from "+GCloudSessionDataStore.EntityDataModel.KIND);
|
||||||
|
|
||||||
Query<Entity> query = builder.build();
|
Query<Entity> query = builder.build();
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class GCloudSessionTestSupport
|
||||||
public void listSessions () throws Exception
|
public void listSessions () throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
GqlQuery.Builder builder = Query.gqlQueryBuilder(ResultType.ENTITY, "select * from "+GCloudSessionDataStore.EntityDataModel.KIND);
|
GqlQuery.Builder builder = Query.newGqlQueryBuilder(ResultType.ENTITY, "select * from "+GCloudSessionDataStore.EntityDataModel.KIND);
|
||||||
|
|
||||||
Query<Entity> query = builder.build();
|
Query<Entity> query = builder.build();
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public class GCloudSessionTestSupport
|
||||||
|
|
||||||
public void assertSessions(int count) throws Exception
|
public void assertSessions(int count) throws Exception
|
||||||
{
|
{
|
||||||
Query<Key> query = Query.keyQueryBuilder().kind(GCloudSessionDataStore.EntityDataModel.KIND).build();
|
Query<Key> query = Query.newKeyQueryBuilder().setKind(GCloudSessionDataStore.EntityDataModel.KIND).build();
|
||||||
QueryResults<Key> results = _ds.run(query);
|
QueryResults<Key> results = _ds.run(query);
|
||||||
assertNotNull(results);
|
assertNotNull(results);
|
||||||
int actual = 0;
|
int actual = 0;
|
||||||
|
@ -165,7 +165,7 @@ public class GCloudSessionTestSupport
|
||||||
|
|
||||||
public void deleteSessions () throws Exception
|
public void deleteSessions () throws Exception
|
||||||
{
|
{
|
||||||
Query<Key> query = Query.keyQueryBuilder().kind(GCloudSessionDataStore.EntityDataModel.KIND).build();
|
Query<Key> query = Query.newKeyQueryBuilder().setKind(GCloudSessionDataStore.EntityDataModel.KIND).build();
|
||||||
QueryResults<Key> results = _ds.run(query);
|
QueryResults<Key> results = _ds.run(query);
|
||||||
|
|
||||||
if (results != null)
|
if (results != null)
|
||||||
|
|
Loading…
Reference in New Issue