gs-rest-service-0.1.0.war復制到tomcat-9.0.0.M17\webapps\
打開server.xml,這Host節點,加入<Context?path="/gs"?docBase="gs-rest-service-0.1.0.war"?debug="0"?privileged="true"/>?
gs相當于虛擬目錄,docBaset填寫相對應Host 的 appBase的地址,加后綴war
<Host?name="localhost"??appBase="webapps"
unpackWARs="true"?autoDeploy="true">
<!--?SingleSignOn?valve,?share?authentication?between?web?applications
Documentation?at:?/docs/config/valve.html?-->
<!--
<Valve?className="org.apache.catalina.authenticator.SingleSignOn"?/>
-->
<!--?Access?log?processes?all?example.
Documentation?at:?/docs/config/valve.html
Note:?The?pattern?used?is?equivalent?to?using?pattern="common"?-->
<Valve?className="org.apache.catalina.valves.AccessLogValve"?directory="logs"
prefix="localhost_access_log"?suffix=".txt"
pattern="%h?%l?%u?%t?"%r"?%s?%b"?/>
<!--?Tomcat?Manager?Context?-->?
<Context?path="/gs"?docBase="gs-rest-service-0.1.0.war"?debug="0"?privileged="true"/>?
</Host>
可以用地址訪問:
http://localhost:8080/gs/greeting/