WebSphere Application Server V5: Separating Static and Dynamic Web Content

Abstract

This tip describes how to separate static content from a WebSphere application so it can be served by the Web server instead of the application server.

Contents


Separating static and dynamic Web content
Separating your static Web content (HTML, GIF, CSS files, etc.) and dynamic Web content (servlets and JSPs) allows processing capacity to be split between the Web server and application server. You can then allocate capacity between the two based on the amount of dynamic and static content in your site. If your site serves mostly static content, it is more cost effective to add more Web servers than it is to add more application servers.

To separate a Web application's static and dynamic Web content:
  • Disable the WebSphere file-serving feature in the Web module:
    • Start the Application Assembly Tool (AAT), for example:
      <WAS_HOME>/bin/assembly
    • Select File -> Open... from the AAT main menu and open the enterprise archive (EAR) file.
    • Select the required Web module in the navigation tree on the left. Click the IBM Extensions tab on the right, then un-check the File serving enabled option, as shown in the figure below. Click Apply.

Screen shot showing how to disable file serving for a Web module using AAT
    • Save your changes and exit AAT.
  • Install the updated EAR file on your application server machine.
    • You can do this using the WebSphere Administrative Console, or wsadmin.
  • Copy the plug-in configuration file (<WAS_HOME>/config/cells/plugin-cfg.xml) to the remote Web server machine.

    This is the plugin-cfg.xml entry when the WebSphere file serving feature is enabled:
      <UriGroup Name="default_host_server1_appsrv1l_Cluster_URIs">
      ...
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/*"/>
      </UriGroup>
    WebSphere will serve all URIs starting with /itsobank/....
    Now that we have disabled the file-serving feature of WebSphere, only JSP and servlet URIs are served by the application server. Regenerating the plug-in configuration updates the plugin-cfg.xml entry as follows:
      <UriGroup Name="default_host_server1_appsrv1l_Cluster_URIs">
      ...
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/servlets/Transfer"/>
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/servlets/JMSTransfer"/>
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" Name="/itsobank/servlet/*"/>
      </UriGroup>

    WebSphere has intelligently updated the plug-in file to let the Web server serve static content. The Web server passes dynamic URIs for servlets and JSPs back to WebSphere.
  • Next we need to set up the Web server to serve the application's static content.
    • First, extract the static content from the application archive and copy it to the Web server.
      • Tip: To prevent errors and to make the process repeatable, it is best to use some type of script to extract and deploy the static content to the Web server. Alternatively, intelligent content management software can be used to automatically route documents around the network when they are updated.
    • Next, add an alias for the application's static content folder to the IBM HTTP Server configuration:
      • Open the <IHS_HOME>/conf/httpd.conf file in an editor and add the required alias to the end of the file, for example:
        Alias /itsobank/ "C:/IBMHttpServer/htdocs/itsobank"
      • Save your changes.
    • Restart the IBM HTTP Server.
  • Try out the application from your browser.

    The Web server should serve the static content. If you stop the application server, you should still get the static pages from the Web server, but servlets or JSPs can’t be accessed.
For more detailed information on this topic, please refer to the following IBM Redbooks publication:
IBM WebSphere V5.0 for Linux, Implementation and Deployment Guide: WebSphere Handbook Series, REDP3601

Special Notices

This material has not been submitted to any formal IBM test and is published AS IS. It has not been the subject of rigorous review. IBM assumes no responsibility for its accuracy or completeness. The use of this information or the implementation of any of these techniques is a client responsibility and depends upon the client's ability to evaluate and integrate them into the client's operational environment.

Profile

Publish Date
24 June 2003


Rating: Not yet rated


Author(s)

IBM Form Number
TIPS0223