Home


Caching the response

The concepts that apply to caching JSPs for Web requests also apply to the caching of JSPs for generating Web service responses. The only difference is that the JSP produces XML instead of HTML.

To cache a full Web service create the JSP cache entry that produces the Web service response, as shown in Example | -1. The parameters passed to the JSP appear as the request parameters and the command context and request properties appear in the request attribute. These parameters and attributes are used as cache keys to specify the cache entry for the JSP.

Example: A-1 Cache entry for a Web service

<cache-entry> 
           <class>servlet</class> 
           <name>/webservices/MyCompany/ProductInformation.jsp</name> 
           <property name="save-attributes">false</property> 
     
           <cache-id> 
               <component id="productId" type="parameter"> 
                   <required>true</required> 
               </component> 
               <component id="CommandContext" type="attribute">
      <method>getStoreId</method>
      <required>true</required>
    </component>
           </cache-id> 
      </cache-entry>

A JSP fragment can be reused in other JSPs so if a JSP caching policy is created for a fragment, other JSP will reuse the cached fragment. Suppose, for example, a response returns a list of products. Suppose a product node is a separate JSP fragment; then each product fragment is cached separately. When a different list of products is displayed in another page, the cached products are used rather than re-executing the JSP fragment for each individual product.

For an example of caching a Web service response, refer to step 8 of the Defining an inbound Web service tutorial.

http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/topic/com.ibm.commerce.webservices.doc/tutorial/twvinboundws.htm

+

Search Tips   |   Advanced Search