1. 程式人生 > >jetty小技巧:plugin方式下,如何調整啟動的埠號;jetty獨立部署時,如何修改上下文contextPath

jetty小技巧:plugin方式下,如何調整啟動的埠號;jetty獨立部署時,如何修改上下文contextPath

1)plugin方式下,如何調整啟動的埠號

複製程式碼
<plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${maven-jetty-plugin_version}</version>
                <configuration>
                    <
connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8080</port> </connector> </connectors> <stopKey>exit</
stopKey> <stopPort>9090</stopPort> <scanIntervalSeconds>10</scanIntervalSeconds> <webAppConfig> <contextPath>/${project.artifactId}</contextPath> <!--<contextPath>/</contextPath>
--> </webAppConfig> </configuration> </plugin>
複製程式碼

connector節點下的port即是啟動埠

2)jetty獨立部署時,如何修改contextPath?

在WEB-INF/放一個jetty-web.xml檔案,參考以下內容:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
 </Configure>

轉載地址:http://www.cnblogs.com/yjmyzz/p/4123054.html