Skip to content

SampleConfiguration

Technology Consortium edited this page May 25, 2023 · 1 revision

Introduction

Like most of the other open source frameworks, this originated from a very personal and specific requirement. ResponseHeaderFilter is much more extensive and extensible than what it originally was. This has happened only because of users like yourself, who have kept me enthused by sending feature requests.

The easiest way to get involved is help me fix the open issues. Create issues only when they have not been reported earlier. I would appreciate initiatives for helping me out to create better and elaborate documentation for this filter./WEB-INF/response-header-filter.xml

For details on the contents of this file, go here - http://code.google.com/p/responseheaderfilter/wiki/ConfigXml 

If one of your AJAX request handlers was fetching, lets say, a list of cities or countries (which thankfully don't change very often), you would want the browser to cache these responses and that too for a significantly longer time.

The ResponseHeaderFilter gives you the power of mappings, wherein you can have mappings based on a query parameter in the request and its expected value (which can be a Pattern)

Underneath is an example of how to specify directives to cache responses for all "/ajax/.html?fetch=country" or "/ajax/.html?fetch=city" requests for a day

<conditional queryParamName="type" queryParamValue="(country|city)">
  <response-headers>
<header key="Content-Type" value="text/xml"/>
    <header key="Cache-Control" value="private, max-age=86400"/>
  </response-headers>
</conditional>

Next steps

  1. Get minute details on the node elements and their attributes in the configuration here.
  2. Interested in implementing a custom behaviour? Learn how to extend this API.
  3. Learn how to get started on this filter in your webapp.

Clone this wiki locally