在工作中,会遇到开发环境和线上环境,请求url不同的情况,就需要在开发环境中配置一下context path,来模拟线上环境。

<span style="font-size:14px;"><plugin>
				<!-- http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin -->
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<configuration>
					<stopPort>9966</stopPort>
					<stopKey>foo</stopKey>
					<scanIntervalSeconds>0</scanIntervalSeconds>
					<connectors>
						<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
							<port>80</port>
							<maxIdleTime>60000</maxIdleTime>
						</connector>
					</connectors>
					<webAppConfig>
						<contextPath>/web/salehomepage/</contextPath>
					</webAppConfig>
				</configuration>
			</plugin></span>

 

如果使用maven和jetty插件这种开发方式的话,就可以像上面这样设置contextPath。

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐