Hi Alexei,
  Thank you for all your help.  I finally got this working today by doing
the following in the file /etc/jetty/contexts/root-context.xml

<?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.handler.MovedContextHandler">
    <Set name="ContextPath">
        /
    </Set>
    <Set name="NewContextURL">
        /aviator
    </Set>
    <Set name="Permanent">
        true
    </Set>
    <Set name="DiscardPathInfo">
        true
    </Set>
    <Set name="DiscardQuery">
        true
    </Set>
</Configure>


This works perfectly.  It redirects the root context "/" to my application's
context.

Thanks!

Todd

On 22 February 2011 21:24, Alexei Mikhailov
<[email protected]>wrote:

> On 2/21/11 9:59 PM, Todd Nine wrote:
>
>  <?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
>>
>
> Hi again!
> At least in my Jetty 6.1.15 under etc there is jetty-rewrite.xml
> configuration file, which you can use as a complement to other configuration
> files when starting jetty.
>
> There are few examples in that one related to different rewrite handlers. I
> tested RedirectPatternRule from that file with "/*" as a pattern and
> "/thiswasrewritten" as replacement, and it worked as it should -- when I
> called http://localhost:8080/whereami, it got redirected to
> http://localhost:8080/hereiam.
>
> So compare your configuration with the one in Jetty's etc (or maybe adopt
> that one for your needs?)
>
> Hope that helps.
> Alex-
>
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to