Turn off path compaction as a side effect in rewrite handler.
There is an explicit rule for that!
This commit is contained in:
Greg Wilkins 2016-05-12 12:48:55 +10:00
parent 016fc6569f
commit fc9063eeb9
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.http.HttpVersion;
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.server.ConnectorStatistics;
import org.eclipse.jetty.server.DebugListener;
@ -63,11 +65,17 @@ public class LikeJettyXml
// Find jetty home and base directories
String homePath = System.getProperty("jetty.home", jettyHomeBuild);
File homeDir = new File(homePath);
if (!homeDir.exists())
File start_jar = new File(homePath,"start.jar");
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");
File baseDir = new File(basePath);
if(!baseDir.exists())
@ -188,6 +196,10 @@ public class LikeJettyXml
server.setHandler(stats);
ConnectorStatistics.addToAllConnectors(server);
// === Rewrite Handler
RewriteHandler rewrite = new RewriteHandler();
rewrite.setHandler(server.getHandler());
server.setHandler(rewrite);
// === jetty-requestlog.xml ===
NCSARequestLog requestLog = new NCSARequestLog();

View File

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