Trainologic

Virtual directories in WebSphere

by rankMay 21, 2009

The idea of using virtual directories for web applications, is to enable content serving from several locations, using some specified url. This is very useful for example for static content that is shared between several web applications inside the application server.

The servlet spec defines the ServletContext idea, which means that all the resources (dynamic and static) must be packed with the web application. So there is no standard thet defines how to achieve access to outside resources. Usually application servers support this by using a special extension.

To do that with WebSphere, we have to go into almost undocumented territory (don’t you love when WebSphere people do that..) and check the ibm-web-ext.xmi file.

What you should do is enable file serving and then set some attributes that will control it.
Here is an example of a ibm-web-ext.xmi:

<webappext:WebAppExtension xmi:version=”2.0″ xmlns:xmi=”http://www.omg.org/XMI” xmlns:webappext=”webappext.xmi”
xmlns:webapplication=”webapplication.xmi” xmi:id=”WebApp_ID_Ext” reloadInterval=”3″ reloadingEnabled=”true”
fileServingEnabled=”true” directoryBrowsingEnabled=”false” serveServletsByClassnameEnabled=”false”
preCompileJSPs=”false” autoRequestEncoding=”false” autoResponseEncoding=”false”>
  <webApp href=”WEB-INF/web.xml#WebApp_ID”/>
  <fileServingAttributes xmi:id=”FSA_1″ name=”extendedDocumentRoot” value=”C:/static_content”/>
  <fileServingAttributes xmi:id=”FSA_2″ name=”file.serving.patterns.allow” value=”images/*”/>
</webappext:WebAppExtension>

as you can see, I have added two file serving attributes:

  1. extendedDocumentRoot attribute - this one allows you to put a comma delimited list of locations or jar files to look in. those locations can be outside the war file, anywhere on the file system.
  2. file.serving.patterns.allow attribute - control which resources should be served by using URL patterns. You can use a space delimited list of patterns.

Now you can access your static resources with the following URL:
http://yourserver:9080/yourContextRoot/images/myimage.gif

Other available attributes can be found in http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/cweb_flserv.html

Ran.

8 Responses to “Virtual directories in WebSphere”

AndrewBoldman Says:

Hi, cool post. I have been wondering about this topic,so thanks for writing.

KattyBlackyard Says:

Hi, interest post. I’ll write you later about few questions!

lezdom forced bondage Says:

well.. it’s like I said!

GarykPatton Says:

I have been looking looking around for this kind of information. Will you post some more in future? I’ll be grateful if you will.

Richard J McPhalrin Says:

Hi,
well written article, I think our views on Virtual directories in WebSphere differ a little however you put foward some good points

Thanks

HARRY Says:


PillSpot.org. Canadian Health&Care.Best quality drugs.No prescription online pharmacy.Special Internet Prices. No prescription pills. Order pills online

Buy:Cialis Super Active+.Super Active ED Pack.Viagra Professional.Zithromax.Viagra Super Active+.Viagra Soft Tabs.Cialis Professional.Viagra Super Force.Levitra.Maxaman.Tramadol.Cialis Soft Tabs.Cialis.VPXL.Propecia.Viagra.Soma….

Cabinet Says:

Cabinet http://qradioehum.bestpartsstore.info/tag/1+drawer+cabinet+Cabinet/ : drawer…

cabinet…

DONALD Says:


CheapTabletsOnline.Com. Canadian Health&Care.Best quality drugs.No prescription online pharmacy.Special Internet Prices. Online Pharmacy. Buy drugs online

Buy:Cozaar.Seroquel.Zocor.Female Pink Viagra.Ventolin.Nymphomax.Female Cialis.Amoxicillin.Lipothin.Buspar.SleepWell.Wellbutrin SR.Acomplia.Advair.Lipitor.Lasix.Benicar.Prozac.Aricept.Zetia….

Leave a Reply

*

*

*

Virtual directories in WebSphere

by rankMay 21, 2009
The idea of using virtual directories for web applications, is to enable content serving from several locations, using some specified url. This is very useful for example for static content that is shared between several web applications inside the application server. The servlet spec defines the ServletContext idea, which means that all the resources (dynamic and static) must be [...]

Virtual directories in WebSphere