+

Search Tips   |   Advanced Search

Configure alternate URL

Alternate URL is a method for edge caching JSP files and servlet responses that we can not request externally. Dynamic cache provides support to recognize the presence of an Edge Side Include (ESI) processor and to generate ESI include tags and appropriate cache policies for edge fragments that can be cached. However, we must be able to externally request an edge fragment from the application server before it can be cached. In other words, if a user types the URL in their browser with the appropriate parameters and cookies for the fragment, WebSphere Application Server must be able to return the content for that fragment.

One of the standard Java EE programming architectures is the model-view-controller (MVC) architecture, where a call to a controller servlet might include one or more child JSP files to construct the view. When using the MVC programming model, the child JSP files are edge cached only if we can request these JSP files externally, which is not usually the case. For example, if a child JSP file uses one or more request attributes that are determined and set by the controller servlet, we cannot cache that JSP file on the edge. Use alternate URL support to overcome this limitation by providing an alternate controller servlet URL used to invoke the JSP file.

The alternate URL for a JSP file or a servlet is set in the cachespec.xml file as a property with the name alternate_url. We can set the alternate URL either on a per cache-entry basis or on a per cache-id basis. It is valid only if the EdgeCacheable property is also set for that entry. If the EdgeCacheable property is not set, the alternate_url property is ignored. The following is a sample cache policy using the alternate_url property:


What to do next

For more information on the cachespec.xml file, refer to the cachespec.xml file topic.

  • cachespec.xml file