[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Help with configuring webapp to redirect
|
On Sun, 2011-02-20 at 10:54 +0200, Alexei Mikhailov wrote:
On 2/20/11 3:27 AM, Todd Nine wrote:
> Hi guys,
> I'm trying to redirect all requests to the root webapp to the
> "/aviator" I've created this file and put in /etc/jetty/contexts. I'm
> running the latest jetty 6 on ubuntu 10.04
>
>
> <?xmlversion="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPEConfigurePUBLIC"-//Mort Bay Consulting//DTD Configure//EN"
> "http://jetty.mortbay.org/configure.dtd">
> <Configureclass="org.mortbay.jetty.webapp.WebAppContext">
> <Setname="contextPath">/</Set>
> <Callname="addHandler">
> <Arg>
> <Newclass="org.mortbay.jetty.handler.rewrite.RedirectPatternRule">
> <Set name="pattern">*</Set>
> <Set name="location">/aviator</Set>
> </New>
> </Arg>
> </Call>
> </Configure>
>
Might it be that you need a leading spash for "pattern" attribute? I
would guess it should be like "/*"...
Jetty 7 docs at jarvana have some more examples:
http://www.jarvana.com/jarvana/view/org/eclipse/jetty/aggregate/jetty-all/7.1.6.v20100715/jetty-all-7.1.6.v20100715-javadoc.jar!/org/eclipse/jetty/rewrite/handler/RewriteHandler.html
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users
Thanks Alexi,
I found an example that should work with Jetty 6. Here is what I've defined.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "
http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">
/
</Set>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.rewrite.RewriteHandler">
<Call name="addRule">
<Arg>
<New id="rootRewrite" class="org.mortbay.jetty.handler.rewrite.RedirectPatternRule">
<Set name="pattern">
/*
</Set>
<Set name="location">
/aviator
</Set>
</New>
</Arg>
</Call>
</New>
</Set>
</Configure>
However, when I open localhost:8080/, I'm not redirected to localhost:8080/aviator as I need. Everything parses, and I've used similar rules in apache, so I'm surprised this one doesn't work