While this works fine, sometimes I want to be able to see what the page looks like without caching quickly, without having to edit cachespec.xml. Sometimes the changes to cachespec.xml would require creating a support ticket to modify a QA or DEV environment.
A more dynamic solution is to use a servlet filter to disable caching for a top level page without touching DynaCache.
Here is code for such a servlet filter:
This filter will disable caching when the URL contains the parameter "nocache" with value "true".
Keep in mind that this only disables caching for the URL you are hitting in your browser and does not affect caching of child fragments which are not consumed by that URL.
This filter should only be used in DEV or QA environments.