tomcat 8資源の引用のいくつかの小さい技巧

5788 ワード

tomcat 8資源の引用のいくつかの小さい技巧
      原文の住所:http://mikusa.blogspot.com/2014/07/tips-on-migrating-to-tomat-8-resources.html
      いくつかの原因のため、元の住所は多くの人が訪問できません.ここで翻訳文を書いて、参考にします.時間のために、ここでは最初の部分だけを大雑把に訳して、主要な意味を表します.以下は私の部分の通訳です.
     Tomcat 7からTomcat 8までの一つの主な変化は、Tomcatがネットワークアプリケーションリソースを処理する方法です.tomcat 7では、ユーザは、aliases、Virtualllader、Virtual DirContectなどの特性を利用して、自分のAPPに追加のリソースサポートを提供することができる.しかし、これらの特性は、それぞれ構成に使用される必要がありますが、tomcat 8では、この統一アーキテクチャに組み込まれているので、彼らの構成がより楽になります.
これらの整合、再構成のため、context構成のいくつかの特性は、resource構成に取って代わられました.この掲示板では、古いバージョンのtomcat 7から新しいバージョンのtomcat 8へのresource配置のいくつかの変更について議論します.
Aliases
tomcat 7において、Contect構成には、tomcatにリソースをロードさせる際に、他のディレクトリを追加的にロードする特性があります.aliasesを使うにはいくつかの理由がありますが、主にユーザーがWARファイル以外の集中位置にJARファイルを置くことができるようにするためです.
以下はaliasesの構成例である.
以下はtomcat 8リゾーツ構成の一例である.


  

    

  

後ろの部分は自分で訳してみてください.全部簡単です.
以下は原文です
Tips on Migrating to Tomat 8-Resource
One of the major changes from Tomcat 7 to Tomcat 8 was a refactoring with how Tomcat handles web appration reource. With Tomcat 7、there re re feature s like aliases、Virtual Loader and Virtual DirConteet that provide admins with a way to put external inton ap. Unfortunary,each one of these feature s was implemented separately so to so so so soso so soso sosold thiness and make them make the m ease the make the m make the mcantain 8,all of thereefferent mcat 8 Contect configration were removed and replacced with the Resource configration. This migration tip discusses how to switch from using common variation s of the old Tomcat 7 configration to the new Tomcat 8 Resource configration.
Aliases
In Tomcat 7,the Contect configration aliases which can be used to provide a list of external locations from which Tomcat will load resoures for the context. The were a few reasons to use this、but one common reason was to use it to include static reource or configration that an administrator wanted to place of a WAR file.
Here's an example configration using aliases.
	
Here's an example of the same configration using Tomcat 8's Resource.

  
    
  
 
Virtual DirContext
The Virtual DirContect feature is simiar to aliases but was tageted as a development feature. The suggaestion for using it is so that you do not have to deploy an entire WAR file. Instead、you can point to the location of your static resour project and only copy、zip and deploy the code itself.
Here is an example of how this was used under Tomcat 7. In this case,I'm using it to point to picture and movie astes that need to be includ with the appication.

    
?The same configration under Tomcat 8 would look like this.

  
    
    
  
Virtual WebappLoaderIt's also possible to use a Pressoures. The difference would be that resource with a PostResource(are checed after resource bundled in the web appection s and resource with the PreResource the resource)ウェブサイト In other words,Pressource can be used to override a resource that is includ with an appication.
The Virtual WebappLoader feature is used to additional directores or JAR files onto the class path. This is different from the previous two options because it allows you to add JAR files、clases or configration to the class path and not just the file system. Again、there are a few reasons why you might want to this、one comon reason was so that You could purl JAR files out from the WAR file to a centralized location.
Here's an example of how this was configred with Tomcat 7.

  
?Here's an example of how this configred with Tomcat 8.

  
    
    
  
If you were using the search External First atribute of the Virtual WebappLoader class,switch from using a PostResource(to a Pressource)
Additional Information
That covers some of the comon configration scenaros that have been changed due to the new Resource API. For more information on this change、I would suggest the follwing reource.
・ Resource Cofigration Docs
・ Migration Gide-Web Application Resource
・ WebResource Root JavaDoc
Feel free to drop me a comment if I missed anything.