Giving an URL connection established through the function http.connection returns a map with the fields of the header.
1 http.connection.getHeaderFields
<http.connection.getHeaderFields>
<http_connection /> !
</http.connection.getHeaderFields>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Ehttp_connection | HttpURLConnectionWrapper | URL connection established to a web address. |
Returns | |
---|---|
Type | Description |
map | Returns a map with all the fields of the header of an established URL connection and the list of all its values. |
Example
Obtain the map of the fields of the header of an URL connection. The function http.connection returns an URL connection and with http.conection.getHeaderFields all the fields of the header are obtained. For each entry on the map, the list of values of each field is traversed.
Copy
<xsql-script name='http_connection_ghfs'> <body> <set name='m_map'> <http.connection.getHeaderFields> <http.connection url='http://www.google.es' /> </http.connection.getHeaderFields> </set> <iterator name='it' type='key'> <in> <m_map /> </in> <do> <set name='list'><map.get name='m_map'><it /></map.get></set> <print>Header field <it />:</print> <println><list /></println> </do> </iterator> </body> </xsql-script>