0
我測試的碼頭9重寫功能,試圖改寫以下網址:如何配置Jetty URL重寫處理程序?
http://localhost/rewrite到http://localhost/test.html
這裏是我的配置:
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<Set name="handler"><Ref refid="oldhandler"/></Set>
<Set name="rewriteRequestURI"><Property name="jetty.rewrite.rewriteRequestURI" deprecated="rewrite.rewriteRequestURI" default="true"/></Set>
<Set name="rewritePathInfo"><Property name="jetty.rewrite.rewritePathInfo" deprecated="rewrite.rewritePathInfo" default="false"/></Set>
<Set name="originalPathAttribute"><Property name="jetty.rewrite.originalPathAttribute" deprecated="rewrite.originalPathAttribute" default="requestedPath"/></Set>
<!-- Set DispatcherTypes -->
<Set name="dispatcherTypes">
<Array type="javax.servlet.DispatcherType">
<Item><Call class="javax.servlet.DispatcherType" name="valueOf"><Arg>REQUEST</Arg></Call></Item>
<Item><Call class="javax.servlet.DispatcherType" name="valueOf"><Arg>ASYNC</Arg></Call></Item>
</Array>
</Set>
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Set name="pattern">/rewrite</Set>
<Set name="replacement">/test.html</Set>
</New>
</Arg>
</Call>
</New>
...
</Configure>
開幕http://127.0.0.1/test.html在瀏覽器中工作,但http://localhost/rewrite給我一個404錯誤。
我配置錯了嗎?