This filter extracts the values of query string parameters and/or HTTP headers from
a REST request and stores them in separate message attributes. The REST request can
be an HTTP GET or POST request. This filter is found in the Attributes
category in the Policy Studio. For details on how to create a REST request, see the
Create REST Request filter.
Example REST Request
The following example shows an incoming REST request with query string and HTTP headers:
| | |
|
POST /services?name=Niall&location=Dublin&location=Pembroke%20St HTTP/1.1
Host: mail.google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
| |
| | |
|
Using this example, the Extract REST Request Attributes filter generates and
populates the following message attributes:
| | |
|
http.header.Host = mail.google.com
http.header.User-Agent = Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15
http.header.Accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
http.header.Accept-Language = en-gb,en;q=0.5
http.header.Accept-Encoding = gzip,deflate
http.header.Accept-Charset = ISO-8859-1,utf-8;q=0.7,*;q=0.7
http.querystring.name = Niall
http.querystring.location.1 = Dublin
http.querystring.location.2 = Pembroke St
| |
| | |
|
Note:
For multi-valued query string parameters (for example, location ), each value
is given an incremental index. For example, the multi-valued location
parameter results in the creation of the http.querystring.location.1 and
http.querystring.location.2 message attributes.
The purpose of this filter is to extract all parameters from an incoming REST request
and store them in separate message attributes so that they can be validated easily,
without needing to iterate through the set of http.headers .
|