Index: modules/http-util/src/main/java/com/sun/grizzly/tcp/http11/GrizzlyAdapterChain.java =================================================================== --- modules/http-util/src/main/java/com/sun/grizzly/tcp/http11/GrizzlyAdapterChain.java (revision 3431) +++ modules/http-util/src/main/java/com/sun/grizzly/tcp/http11/GrizzlyAdapterChain.java (working copy) @@ -218,7 +218,7 @@ * Add a {@link GrizzlyAdapter} and its assciated array of mapping. The mapping * data will be used to map incoming request to its associated {@link GrizzlyAdapter}. * @param adapter {@link GrizzlyAdapter} instance - * @param mappings an array of mapping. + * @param mappings an array of mappings that may contain wildcards */ public void addGrizzlyAdapter(GrizzlyAdapter adapter, String[] mappings){ if (oldMappingAlgorithm){ @@ -232,9 +232,18 @@ adapters.put(adapter,mappings); for(String mapping: mappings){ String ctx = getContextPath(mapping); + // FIXME: those welcome resources should come from somewhere else (web.xml would define them, for example) mapper.addContext(LOCAL_HOST, ctx, adapter, new String[] {"index.html", "index.htm"}, null); - mapper.addWrapper(LOCAL_HOST, ctx,mapping.substring(ctx.length()), adapter); + + String path = mapping.substring(ctx.length()); + // The path now starts with a '/', which needs further massaging if this mapping was originally + // intended as extension match. + if (path.startsWith("/*.")) { + // Extension mapping, drop the leading '/' + path = path.substring(1); + } + mapper.addWrapper(LOCAL_HOST, ctx, path, adapter, true); } } }