[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Using MovedContextHandler with the maven-jetty-plugin
|
Nick,
Perhaps having a read of the doco as regards deploying other contexts
alongside the webapp that is the subject of the jetty-maven-plugin
will help. See http://www.eclipse.org/jetty/documentation/9.0.6.v20130930/jetty-maven-plugin.html,
section "Running More than One Webapp".
Jan
On 25 February 2014 08:02, Nick Watts <nick.a.watts@xxxxxxxxx> wrote:
> Hello all,
>
> I want to setup a permanent HTTP redirect in the embedded Jetty server that
> I'm using in my Maven build. I'm using Maven 3.0.4 and the
> jetty-maven-plugin version 9.0.6.v20130930. The Jetty documentation clearly
> demonstrates how to set this up in a non-embedded Jetty instance, but I
> can't quite figure out how to to set it up when running inside of Maven.
>
> Here's the context XML file I'm using to do the redirect from
> /permanently-moved-feeds to /
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
> "http://www.eclipse.org/jetty/configure_9_0.dtd">
>
> <Configure class="org.eclipse.jetty.server.handler.MovedContextHandler">
> <Set name="contextPath">/permanently-moved-feeds</Set>
> <Set name="newContextURL">/</Set>
> <Set name="permanent">true</Set>
> <Set name="discardPathInfo">false</Set>
> <Set name="discardQuery">false</Set>
> </Configure>
>
> Here is the relevant Maven pom.xml configuration:
>
> <plugin>
> <groupId>org.eclipse.jetty</groupId>
>
> <artifactId>jetty-maven-plugin</artifactId>
> <configuration>
>
> <resourcesBases>src/main/webapp,src/main/webapp/test-feeds,src/main/webapp/permanently-moved-feeds</resourcesBases>
>
> <!-- Add src/main/conf/jetty/jetty-logging.xml and create
> a logs folder to enable Jetty logging. -->
>
> <jettyXml>src/main/conf/jetty/jetty.xml,src/main/conf/jetty/contexts/PermanentlyMovedRSS.xml,src/main/conf/jetty/jetty-logging.xml</jettyXml>
>
> </configuration>
> <executions>
> <execution>
> <id>start-jetty</id>
> <phase>pre-integration-test</phase>
>
> <goals>
> <goal>run</goal>
> </goals>
> <configuration>
> <scanIntervalSeconds>10</scanIntervalSeconds>
>
> <daemon>true</daemon>
> </configuration>
> </execution>
> <execution>
> <id>stop-jetty</id>
>
> <phase>post-integration-test</phase>
> <goals>
> <goal>stop</goal>
> </goals>
> </execution>
>
> </executions>
> </plugin>
>
> So my specific question is how do I configure the jetty-maven-plugin so
> that Jetty knows where to find the context XML file in the first XML
> sample? When I run mvn jetty:run, I see that the config files I have
> specified are loaded but when I do a GET
>
> for http://localhost:8080/permanently-moved-feeds, the response status code
> is 200 instead of 301. Am I approaching this configuration in the right way?
>
>
>
>
> --
> Nick Watts
> blog: thewonggei.wordpress.com
> twitter: @thewonggei
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'