Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Help with configuring webapp to redirect

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-

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Back to the top