本文介绍了在Jetty中从http重定向到https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从myurl永久重定向到myurl,但是在Jetty中,我只找到MovedContextHandler,有了它我只能重定向上下文路径,例如从myurl/bla到myurl/bla/bla
I want make permanent redirect from myurl to myurl, but in Jetty I find only MovedContextHandler, with it I can redirect only context path, for examnple from myurl/bla to myurl/bla/bla
<Configure class="org.mortbay.jetty.handler.MovedContextHandler"> <Set name="contextPath">/bla</Set> <Set name="newContextURL">/bla/bla</Set> <Set name="permanent">true</Set> <Set name="discardPathInfo">false</Set> <Set name="discardQuery">false</Set> </Configure>但是如何使用url前缀?
but how can I work with prefix of url?
推荐答案最好在您的/WEB-INF/web.xml
<web-app> ... <security-constraint> <web-resource-collection> <web-resource-name>Everything in the webapp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> </web-app>更多推荐
在Jetty中从http重定向到https
发布评论