| <?xml version="1.0"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" jx:cache-key="${cocoon.request.parameters.toString()}" jx:cache-validity="${Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}"> |
| <h4 class="samplesGroup">JXTG template caching with a dynamic cache key and NOP Validity</h4> |
| <title>All request parameters</title> |
| <content> |
| <p> |
| This content has been generated at <jx:formatDate value="${java.util.Calendar.getInstance().getTime()}" pattern="yyyy-MM-dd HH:mm:ss"/><br/> |
| Request parameters: ${cocoon.request.parameters} |
| </p> |
| <p> |
| Caching configuration is <b>jx:cache-key="$ {cocoon.request.parameters.toString()}" |
| jx:cache-validity="$ {Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}"</b> |
| </p> |
| |
| <p> |
| The content will be cached separately for any combination of request parameters. |
| Once the content is generated it never expires (unless the template source changes).<br/> |
| You have to use $ {cocoon.request.parameters.toString()} instead of $ {cocoon.request.parameters} because the cache-key needs to be Serializable. |
| </p> |
| |
| <p> |
| Try some combinations:<br/> |
| <a href="">Reload the page</a><br/> |
| See <a href="?foo=bar">?foo=bar</a><br/> |
| See <a href="?foo=bar&bar=foo">?foo=bar&bar=foo</a><br/> |
| See <a href="?bar=foo&foo=bar">?bar=foo&foo=bar</a> (Luckily the request parameters' order is irrelevant. TBD: can we rely on such functionality?)<br/> |
| </p> |
| |
| <p> |
| Next sample: <a href="../view/caching4">Setting other validities</a>.<br/> |
| Go <a href="../">Back</a> to Cocoon Template samples. |
| </p> |
| </content> |
| </page> |