开发者

jetty 6 rewrite handler not working web server

开发者 https://www.devze.com 2023-01-07 21:46 出处:网络
I cannot make rewrite handler to work on Jetty server 6.1.24. Here is my example in Scala: val server = new Server(8080);

I cannot make rewrite handler to work on Jetty server 6.1.24. Here is my example in Scala:

val server = new Server(8080);

val contexts = new ContextHandlerCollection();
val rewriteHandler = new RewriteHandler();
rewriteHandler.se开发者_Go百科tRewriteRequestURI(false);
rewriteHandler.setRewritePathInfo(false);
rewriteHandler.setOriginalPathAttribute("requestedPath")
rewriteHandler.addRewriteRule("/site1/test1","/site2/test2");
contexts.addHandler(rewriteHandler);

server.setHandler(contexts);
server.start();

.....

Any ideas? Thanks!


RewriteHandler must wrap server handler. Try to replace:

contexts.addHandler(rewriteHandler);

with:

rewriteHandler.setHandler(contexts);
0

精彩评论

暂无评论...
验证码 换一张
取 消