Merge remote-tracking branch 'origin/jetty-9.4.x'

This commit is contained in:
Greg Wilkins 2016-05-12 12:51:17 +10:00
commit 9179add187
2 changed files with 15 additions and 9 deletions

View File

@ -28,6 +28,8 @@ import org.eclipse.jetty.deploy.bindings.DebugListenerBinding;
import org.eclipse.jetty.deploy.providers.WebAppProvider; import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.rewrite.handler.CompactPathRule;
import org.eclipse.jetty.rewrite.handler.RewriteHandler;
import org.eclipse.jetty.security.HashLoginService; import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.ConnectorStatistics; import org.eclipse.jetty.server.ConnectorStatistics;
import org.eclipse.jetty.server.DebugListener; import org.eclipse.jetty.server.DebugListener;
@ -63,11 +65,17 @@ public class LikeJettyXml
// Find jetty home and base directories // Find jetty home and base directories
String homePath = System.getProperty("jetty.home", jettyHomeBuild); String homePath = System.getProperty("jetty.home", jettyHomeBuild);
File homeDir = new File(homePath); File start_jar = new File(homePath,"start.jar");
if (!homeDir.exists()) if (!start_jar.exists())
{ {
throw new FileNotFoundException(homeDir.getAbsolutePath()); homePath = jettyHomeBuild = "jetty-distribution/target/distribution";
start_jar = new File(homePath,"start.jar");
if (!start_jar.exists())
throw new FileNotFoundException(start_jar.toString());
} }
File homeDir = new File(homePath);
String basePath = System.getProperty("jetty.base", homeDir + "/demo-base"); String basePath = System.getProperty("jetty.base", homeDir + "/demo-base");
File baseDir = new File(basePath); File baseDir = new File(basePath);
if(!baseDir.exists()) if(!baseDir.exists())
@ -185,6 +193,10 @@ public class LikeJettyXml
server.setHandler(stats); server.setHandler(stats);
ConnectorStatistics.addToAllConnectors(server); ConnectorStatistics.addToAllConnectors(server);
// === Rewrite Handler
RewriteHandler rewrite = new RewriteHandler();
rewrite.setHandler(server.getHandler());
server.setHandler(rewrite);
// === jetty-requestlog.xml === // === jetty-requestlog.xml ===
NCSARequestLog requestLog = new NCSARequestLog(); NCSARequestLog requestLog = new NCSARequestLog();

View File

@ -161,9 +161,6 @@ public class RuleContainer extends Rule
{ {
boolean original_set=_originalPathAttribute==null; boolean original_set=_originalPathAttribute==null;
// TODO why is this always done?
target = URIUtil.compactPath(target);
if (_rules==null) if (_rules==null)
return target; return target;
@ -172,9 +169,6 @@ public class RuleContainer extends Rule
String applied=rule.matchAndApply(target,request, response); String applied=rule.matchAndApply(target,request, response);
if (applied!=null) if (applied!=null)
{ {
// TODO why is this always done?
applied = URIUtil.compactPath(applied);
LOG.debug("applied {}",rule); LOG.debug("applied {}",rule);
LOG.debug("rewrote {} to {}",target,applied); LOG.debug("rewrote {} to {}",target,applied);
if (!original_set) if (!original_set)