Javaweb resin4如何配置端口虛擬目錄
在JAVA WEB容器大家族中,Resin可以算的上最輕巧最快速的服務(wù)器了。我個人非常喜歡在產(chǎn)品開發(fā)階段使用Resin來測試和調(diào)試,因?yàn)殚_發(fā)階段需要頻繁地重啟服務(wù)器。在給客戶進(jìn)行產(chǎn)品部署的時候我還是趨向于使用Tomcat,因?yàn)閠omcat是全部免費(fèi)的,而且使用者很多,再加上NIO和GZip模式可以優(yōu)化服務(wù)器性能以及tomcat出色的穩(wěn)定性。
Resin4可以給不同的Web app分配不同的端口,也就是說Resin4可以同時開啟多個端口的服務(wù),這一點(diǎn)是非常贊的,在tomcat中想要實(shí)現(xiàn)這個就必須另外再來一份tomcat,配置不同的端口。而Resin4就不需要了,給不同的應(yīng)用設(shè)置好相應(yīng)的端口就OK了。
Resin4有一個全局端口,也就是默認(rèn)端口,可以在conf/resin.properties文件中,對HTTP元素進(jìn)行簡單的修改,如下:
# Set HTTP and HTTPS ports
http : 8080
#https : 8443
在Resin中創(chuàng)建虛擬目錄的方式是修改conf/resin.xml文件,正如我剛剛說的,每一個虛擬目錄都是一個Web app,都可以配置獨(dú)立的端口號。在resin.xml中一個cluster就代表一個端口應(yīng)用,代碼如下:
<cluster id="app"> <!-- define the servers in the cluster --> <server-multi id-prefix="app-" address-list="${app_servers}" port="6800" /> <host-default> <!-- creates the webapps directory for .war expansion --> <web-app-deploy path="webapps" expand-preserve-fileset="WEB-INF/work/**" multiversion-routing="${webapp_multiversion_routing}" /> </host-default> <!-- auto virtual host deployment in hosts/foo.example.com/webapps --> <host-deploy path="hosts" /> <!-- the default host, matching any host name --> <host id="" root-directory="."> <!-- - webapps can be overridden/extended in the resin.xml --> <web-app id="/" root-directory="webapps/ROOT" /> <web-app id="/jPress" root-directory="D:\workspace\java\myeclipse10\jPress\WebRoot" /> <resin:if test="${resin_doc}"> <web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc" /> </resin:if> </host> </cluster>
這個cluster是web-app的主簇,在其中添加<web-app>標(biāo)簽就可以配置虛擬目錄了,這時候這個應(yīng)用是使用默認(rèn)端口進(jìn)行部署的。如果要給這個簇配置特定的端口號,可以在cluster標(biāo)簽第一個元素前面加上<server-default>標(biāo)簽,如下:
<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="urn:java:com.caucho.resin"> <cluster-default> <!-- shared configuration across all clusters --> <resin:import path="classpath:META-INF/caucho/app-default.xml" /> <resin:import path="${__DIR__}/health.xml" optional="true" /> </cluster-default> <cluster id="my-cluster"> <server-default> <!-- thread limits, JVM config, keepalives, ports, HTTP --> <http port="8083" /> </server-default> <host id="www.myhost.com" root-directory="hosts/myhost.com"> <resin:MovedPermanently regexp="/old-file" target="/new-path" /> <web-app-deploy path="webapps" expand-preserve-fileset="WEB-INF/work/**" /> <web-app id="/custom"> </web-app> </host> </cluster> </resin>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
PowerJob的GridFsManager工作流程源碼解讀
這篇文章主要為大家介紹了PowerJob的GridFsManager工作流程源碼解讀,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2024-01-01Idea?springboot?springCloud熱加載熱調(diào)試兩種常用方式
這篇文章主要介紹了Idea?springboot?springCloud熱加載熱調(diào)試常用的兩種方式,在項(xiàng)目開發(fā)的過程中,需要修改調(diào)試的時候偶每次都需要重啟項(xiàng)目浪費(fèi)時間,下面是我整理的兩種常用的兩種方式,需要的朋友可以參考下2023-04-04springboot之Validation參數(shù)校驗(yàn)詳細(xì)解讀
這篇文章主要介紹了springboot之Validation參數(shù)校驗(yàn)詳細(xì)解讀,本篇是關(guān)于springboot的參數(shù)校驗(yàn)知識,當(dāng)然也適用其它java應(yīng)用,讀完本篇將學(xué)會基本的參數(shù)校驗(yàn),自定義參數(shù)校驗(yàn)和分組參數(shù)校驗(yàn),需要的朋友可以參考下2023-10-10java實(shí)現(xiàn)合并2個文件中的內(nèi)容到新文件中
這篇文章主要介紹了java實(shí)現(xiàn)合并2個文件中的內(nèi)容到新文件中,思路非常不錯,這里推薦給大家。2015-03-03