Merge remote-tracking branch 'origin/jetty-9.4.x'
This commit is contained in:
commit
6a2316fb23
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables GCloud Datastore API and implementation
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
3rdparty
|
||||
gcloud
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Control GCloud API classpath
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
3rdparty
|
||||
gcloud
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables GCloudDatastore session management.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
gcloud
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Deploys the Hawtio console as a webapplication.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
3rdparty
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Deploys the JAMon webapplication
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
3rdparty
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Deploys the Jminix JMX Console within the server
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
3rdparty
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Deploys the Jolokia console as a web application.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
3rdparty
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enables HTTP2 protocol support on the TLS(SSL) Connector,
|
||||
using the ALPN extension to select which protocol to use.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
http2
|
||||
http
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enables the HTTP2C protocol on the HTTP Connector
|
||||
The connector will accept both HTTP/1 and HTTP/2 connections.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
http2
|
||||
http
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables session data store in a local Infinispan cache
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables session data store in a remote Infinispan cache
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Memcache cache for SessionData
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[depends]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables NoSql session management with a MongoDB driver.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -3,7 +3,7 @@ Enables the DebugListener to generate additional
|
|||
logging regarding detailed request handling events.
|
||||
Renames threads to include request URI.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
debug
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Deprecated Debug Log using the DebugHandle.
|
||||
Replaced with the debug module.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
debug
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Adds all jar files discovered in $JETTY_HOME/lib/ext
|
||||
and $JETTY_BASE/lib/ext to the servers classpath.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
classpath
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enable GzipHandler for dynamic gzip compression
|
||||
for the entire server.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
handler
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Adds a forwarded request customizer to the HTTP Connector
|
||||
to process forwarded-for style headers from a proxy.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -3,7 +3,7 @@ Enables a HTTP connector on the server.
|
|||
By default HTTP/1 is support, but HTTP2C can
|
||||
be added to the connector with the http2c module.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
http
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Adds HTTPS protocol support to the TLS(SSL) Connector
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
https
|
||||
http
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enable the ipaccess handler to apply a white/black list
|
||||
control of the remote IP of requests.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
handler
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables logback request log.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
requestlog
|
||||
logging
|
||||
logback
|
||||
|
|
|
@ -5,7 +5,7 @@ This allows a Proxy operating in TCP mode to transport
|
|||
details of the proxied connection to the server.
|
||||
Both V1 and V2 versions of the protocol are supported.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
ssl
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables a NCSA style request log.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
requestlog
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -3,7 +3,7 @@ Adds the $JETTY_HOME/resources and/or $JETTY_BASE/resources
|
|||
directory to the server classpath. Useful for configuration
|
||||
property files (eg jetty-logging.properties)
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
classpath
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -4,7 +4,7 @@ If not enabled, sessions will use a HashSessionCache by default, so enabling
|
|||
via this module is only needed if the configuration properties need to be
|
||||
changed.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
A trivial SessionCache that does not actually cache sessions.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables caching of SessionData in front of a SessionDataStore.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables session persistent storage in files.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[description]
|
||||
Enables JDBC peristent/distributed session storage.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[provides]
|
||||
|
|
|
@ -5,7 +5,7 @@ created or by enabling other session-cache or session-store
|
|||
modules. Without this module enabled, the server may still
|
||||
use sessions, but their management cannot be configured.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
session
|
||||
|
||||
[depends]
|
||||
|
|
|
@ -3,7 +3,7 @@ Enables a TLS(SSL) Connector on the server.
|
|||
This may be used for HTTPS and/or HTTP2 by enabling
|
||||
the associated support modules.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
ssl
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enable detailed statistics collection for the server,
|
||||
available via JMX.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
handler
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Applies ThreadLimiteHandler to entire server
|
||||
#
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
handler
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -107,6 +107,7 @@ public class ServletHandler extends ScopedHandler
|
|||
private boolean _startWithUnavailable=false;
|
||||
private boolean _ensureDefaultServlet=true;
|
||||
private IdentityService _identityService;
|
||||
private boolean _allowDuplicateMappings=false;
|
||||
|
||||
private ServletHolder[] _servlets=new ServletHolder[0];
|
||||
private ServletMapping[] _servletMappings;
|
||||
|
@ -687,6 +688,22 @@ public class ServletHandler extends ScopedHandler
|
|||
_startWithUnavailable=start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the allowDuplicateMappings
|
||||
*/
|
||||
public boolean isAllowDuplicateMappings()
|
||||
{
|
||||
return _allowDuplicateMappings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allowDuplicateMappings the allowDuplicateMappings to set
|
||||
*/
|
||||
public void setAllowDuplicateMappings(boolean allowDuplicateMappings)
|
||||
{
|
||||
_allowDuplicateMappings = allowDuplicateMappings;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return True if this handler will start with unavailable servlets
|
||||
|
@ -1313,7 +1330,7 @@ public class ServletHandler extends ScopedHandler
|
|||
Map<String,ServletMapping> servletPathMappings = new HashMap<>();
|
||||
|
||||
//create a map of paths to set of ServletMappings that define that mapping
|
||||
HashMap<String, Set<ServletMapping>> sms = new HashMap<>();
|
||||
HashMap<String, List<ServletMapping>> sms = new HashMap<>();
|
||||
for (ServletMapping servletMapping : _servletMappings)
|
||||
{
|
||||
String[] pathSpecs = servletMapping.getPathSpecs();
|
||||
|
@ -1321,10 +1338,10 @@ public class ServletHandler extends ScopedHandler
|
|||
{
|
||||
for (String pathSpec : pathSpecs)
|
||||
{
|
||||
Set<ServletMapping> mappings = sms.get(pathSpec);
|
||||
List<ServletMapping> mappings = sms.get(pathSpec);
|
||||
if (mappings == null)
|
||||
{
|
||||
mappings = new HashSet<>();
|
||||
mappings = new ArrayList<>();
|
||||
sms.put(pathSpec, mappings);
|
||||
}
|
||||
mappings.add(servletMapping);
|
||||
|
@ -1337,7 +1354,7 @@ public class ServletHandler extends ScopedHandler
|
|||
{
|
||||
//for each path, look at the mappings where it is referenced
|
||||
//if a mapping is for a servlet that is not enabled, skip it
|
||||
Set<ServletMapping> mappings = sms.get(pathSpec);
|
||||
List<ServletMapping> mappings = sms.get(pathSpec);
|
||||
|
||||
ServletMapping finalMapping = null;
|
||||
for (ServletMapping mapping : mappings)
|
||||
|
@ -1355,9 +1372,15 @@ public class ServletHandler extends ScopedHandler
|
|||
finalMapping = mapping;
|
||||
else
|
||||
{
|
||||
//already have a candidate - only accept another one if the candidate is a default
|
||||
//already have a candidate - only accept another one
|
||||
//if the candidate is a default, or we're allowing duplicate mappings
|
||||
if (finalMapping.isDefault())
|
||||
finalMapping = mapping;
|
||||
else if (isAllowDuplicateMappings())
|
||||
{
|
||||
LOG.warn("Multiple servlets map to path: "+pathSpec+": "+finalMapping.getServletName()+","+mapping.getServletName());
|
||||
finalMapping = mapping;
|
||||
}
|
||||
else
|
||||
{
|
||||
//existing candidate isn't a default, if the one we're looking at isn't a default either, then its an error
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.EnumSet;
|
|||
|
||||
import javax.servlet.DispatcherType;
|
||||
|
||||
import org.eclipse.jetty.http.pathmap.MappedResource;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -47,6 +48,15 @@ public class ServletHandlerTest
|
|||
FilterMapping fm5 = new FilterMapping();
|
||||
|
||||
|
||||
ServletHolder sh1 = new ServletHolder(new Source (Source.Origin.DESCRIPTOR, "foo.xml"));
|
||||
ServletMapping sm1 = new ServletMapping();
|
||||
|
||||
ServletHolder sh2 = new ServletHolder(new Source (Source.Origin.DESCRIPTOR, "foo.xml"));
|
||||
ServletMapping sm2 = new ServletMapping();
|
||||
|
||||
ServletHolder sh3 = new ServletHolder(new Source (Source.Origin.DESCRIPTOR, "foo.xml"));
|
||||
ServletMapping sm3 = new ServletMapping();
|
||||
|
||||
|
||||
@Before
|
||||
public void initMappings()
|
||||
|
@ -70,6 +80,111 @@ public class ServletHandlerTest
|
|||
fh5.setName("fh5");
|
||||
fm5.setPathSpec("/*");
|
||||
fm5.setFilterHolder(fh5);
|
||||
|
||||
sh1.setName("s1");
|
||||
sm1.setDefault(false);
|
||||
sm1.setPathSpec("/foo/*");
|
||||
sm1.setServletName("s1");
|
||||
|
||||
sh2.setName("s2");
|
||||
sm2.setDefault(false);
|
||||
sm2.setPathSpec("/foo/*");
|
||||
sm2.setServletName("s2");
|
||||
|
||||
sh3.setName("s3");
|
||||
sm3.setDefault(true);
|
||||
sm3.setPathSpec("/foo/*");
|
||||
sm3.setServletName("s3");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateMappingsForbidden() throws Exception
|
||||
{
|
||||
ServletHandler handler = new ServletHandler();
|
||||
handler.setAllowDuplicateMappings(false);
|
||||
handler.addServlet(sh1);
|
||||
handler.addServlet(sh2);
|
||||
handler.updateNameMappings();
|
||||
|
||||
handler.addServletMapping(sm1);
|
||||
handler.addServletMapping(sm2);
|
||||
|
||||
try
|
||||
{
|
||||
handler.updateMappings();
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
//expected error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDuplicateMappingsWithDefaults() throws Exception
|
||||
{
|
||||
ServletHandler handler = new ServletHandler();
|
||||
handler.setAllowDuplicateMappings(false);
|
||||
handler.addServlet(sh1);
|
||||
handler.addServlet(sh3);
|
||||
handler.updateNameMappings();
|
||||
|
||||
handler.addServletMapping(sm3);
|
||||
handler.addServletMapping(sm1);
|
||||
|
||||
|
||||
handler.updateMappings();
|
||||
|
||||
MappedResource<ServletHolder> entry=handler.getHolderEntry("/foo/*");
|
||||
assertNotNull(entry);
|
||||
assertEquals("s1", entry.getResource().getName());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDuplicateMappingsSameServlet() throws Exception
|
||||
{
|
||||
ServletHolder sh4 = new ServletHolder();
|
||||
|
||||
sh4.setName("s1");
|
||||
|
||||
ServletMapping sm4 = new ServletMapping();
|
||||
sm4.setPathSpec("/foo/*");
|
||||
sm4.setServletName("s1");
|
||||
|
||||
ServletHandler handler = new ServletHandler();
|
||||
handler.setAllowDuplicateMappings(true);
|
||||
handler.addServlet(sh1);
|
||||
handler.addServlet(sh4);
|
||||
handler.updateNameMappings();
|
||||
|
||||
handler.addServletMapping(sm1);
|
||||
handler.addServletMapping(sm4);
|
||||
|
||||
|
||||
handler.updateMappings();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testDuplicateMappingsAllowed() throws Exception
|
||||
{
|
||||
ServletHandler handler = new ServletHandler();
|
||||
handler.setAllowDuplicateMappings(true);
|
||||
handler.addServlet(sh1);
|
||||
handler.addServlet(sh2);
|
||||
handler.updateNameMappings();
|
||||
|
||||
handler.addServletMapping(sm1);
|
||||
handler.addServletMapping(sm2);
|
||||
handler.updateMappings();
|
||||
|
||||
MappedResource<ServletHolder> entry=handler.getHolderEntry("/foo/*");
|
||||
assertNotNull(entry);
|
||||
assertEquals("s2", entry.getResource().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -752,7 +752,11 @@ public class StartArgs
|
|||
|
||||
public List<String> getListModules()
|
||||
{
|
||||
return listModules;
|
||||
if (listModules == null || listModules.contains("internal") || listModules.contains("-internal"))
|
||||
return listModules;
|
||||
List<String> modules = new ArrayList<>(listModules);
|
||||
modules.add("-internal");
|
||||
return modules;
|
||||
}
|
||||
|
||||
public boolean isRun()
|
||||
|
@ -873,7 +877,7 @@ public class StartArgs
|
|||
if (arg.equals("--create-files"))
|
||||
{
|
||||
run = false;
|
||||
download = true;boolean
|
||||
download = true;
|
||||
licenseCheckRequired = true;
|
||||
return;
|
||||
}
|
||||
|
@ -949,7 +953,7 @@ public class StartArgs
|
|||
// Module Management
|
||||
if ("--list-modules".equals(arg))
|
||||
{
|
||||
listModules = Collections.singletonList("-internal");
|
||||
listModules = Collections.emptyList();
|
||||
run = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,8 @@ Module Management:
|
|||
|
||||
--list-modules=<tag>(,<tag>)*
|
||||
List modules by tag. Use '*' for all tags. Prefix a tag
|
||||
with '-' to exclude the tag.
|
||||
with '-' to exclude the tag. The special tag "internal"
|
||||
is always excluded unless it is explicitly included.
|
||||
|
||||
--list-all-modules
|
||||
List all modules.
|
||||
|
|
|
@ -4,7 +4,7 @@ by the Unix Domain Socket connector, for use when behind a proxy operating
|
|||
in HTTP mode that adds forwarded-for style HTTP headers. Typically this
|
||||
is an alternate to the Proxy Protocol used mostly for TCP mode.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -4,7 +4,7 @@ It should be used when a proxy is forwarding either HTTP or decrypted
|
|||
HTTPS traffic to the connector and may be used with the
|
||||
unix-socket-http2c modules to upgrade to HTTP/2.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
http
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Adds a HTTP2C connetion factory to the Unix Domain Socket Connector
|
|||
It can be used when either the proxy forwards direct
|
||||
HTTP/2C (unecrypted) or decrypted HTTP/2 traffic.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
http2
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ SSL properties may be interpreted by the unixsocket-secure
|
|||
module to indicate secure HTTPS traffic. Typically this
|
||||
is an alternate to the forwarded module.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -5,7 +5,7 @@ This looks for a secure scheme transported either by the
|
|||
unixsocket-forwarded, unixsocket-proxy-protocol or in a
|
||||
HTTP2 request.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
|
||||
[depend]
|
||||
|
|
|
@ -7,7 +7,7 @@ needless fragmentation and have better dispatch behaviours.
|
|||
When enabled with corresponding support modules, the connector can
|
||||
accept HTTP, HTTPS or HTTP2C traffic.
|
||||
|
||||
[Tags]
|
||||
[tags]
|
||||
connector
|
||||
|
||||
[depend]
|
||||
|
|
Loading…
Reference in New Issue