关于Resin虚拟目录配置的问题

阅读更多
项目中多个项目需要同时引用一个静态资源,所以就想到配置不同的虚拟目录指到同一个目录。于是有下面的配置:
    
    
< host  id =""  root-directory ="." >
      

      
< web-app  id ="/"  document-directory ="webapps/ROOT" />
      
< web-app  id ="/community/jsvm2"  document-directory ="D:\\projects\\FelooComponents\\jsvm2" />
      
< web-app  id ="/passport/jsvm2"  document-directory ="D:\\projects\\FelooComponents\\jsvm2" />
    
host >

       但是发现这样只有后面一个管用(http://localhost:8080/passport/jsvm2)这个是可以,可是(http://localhost:8080/community/jsvm2)就不行,很是郁闷。只要后面的document-directory不是同一个目录就成。
       后来在resin的doc里面看到path的配置

path-mapping

child of: web-app-default, web-app

Maps url patterns to real paths. If using a server like IIS, you may need to match the server's path aliases.

AttributeMeaningdefault
url-pattern A pattern matching the url: /foo/*, /foo, or *.foo
url-regexp A regular expression matching the url
real-path The prefix of the real path. When used with url-regexp, allows substitution variables like $1.


            
            
            
            

改正这样的配置就ok了。

         < web-app  id ="/community"  document-directory ="D:\\projects\\FelooCommunityWeb" >
          
< path-mapping  url-pattern ='jsvm2/*'
              
real-path ='D:\\projects\\FelooComponents\\jsvm2'/>
      
>
      
            
< web-app  id ="/passport"  document-directory ="D:\\projects\\FelooPassportWeb" >
          
< path-mapping  url-pattern ='jsvm2/*'
              
real-path ='D:\\projects\\FelooComponents\\jsvm2'/>
      
>
   除经特别注明外,本文章版权归 莫多泡泡所有.
署名,非商业用途,保持一致.   somebody(莫多)

你可能感兴趣的:(Web,IIS)