Configuring a context path for a jetty with static resources

I have a maven application configured to run Jetty, as well as loading statistics from .. / client. Configuration below:

<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.4.v20120524</version> <configuration> <scanIntervalSeconds>25</scanIntervalSeconds> <connectors> <connector implementation="org.eclipse.jetty.server.bio.SocketConnector"> <port>9095</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <webAppSourceDirectory>../client/</webAppSourceDirectory> <webAppConfig> <resourceBases> <resourceBase>src/main/webapp</resourceBase> <resourceBase>../client/</resourceBase> </resourceBases> </webAppConfig> </configuration> </plugin> 

What I'm trying to do is only move the webapp to the / API resource base. To be more explicit, I want to have mappings:

 src/main/webapp ---> /API ../client/ ---> / 
+4
source share
1 answer

Finally, I found the correct config:

 <webAppConfig> <contextPath>/API</contextPath> </webAppConfig> <contextHandlers> <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext"> <contextPath>/</contextPath> <resourceBase>../client/</resourceBase> </contextHandler> </contextHandlers> 
+5
source

All Articles