HEAD()
Usage
HEAD(url, username, password)
HEAD(url)
Description
Sends an HTTP HEAD request to the given url. This method can be used to make HTTP requests from within the Structr Server, triggered by a frontend control like a button etc. The optional username and password parameters can be used to authenticate the request.
The HEAD()
method will return a response object with the following structure:
Field | Description | Type |
---|---|---|
status | HTTP status of the request | Integer |
headers | Response headers | Map |
Note
Please note that the HEAD()
method will not be executed in the security context of the current user. The request will be made by the Structr server, without any user authentication or additional information. If you want to access external protected resources, you will need to authenticate the request using add_header()
. (see the related articles for more information)
Example
${HEAD('http://localhost:8082/structr/rest/User', 'tester', 'test')}
results in
{status=401, headers={Date=Tue, 22 Dec 2015 16:53:30 GMT, Content-Type=application/json; charset=ISO-8859-1, Connection=close, Server=Jetty(9.2.9.v20150224)}}