-
Notifications
You must be signed in to change notification settings - Fork 15
Advanced Features
The TimeGate can be used as a TimeMap server too. For that there are two requirements:
- The Handler must implement the
get_all_mementos(uri_r)
function. To return the entire list of URI-Ms for a resource that will be converted into a TimeMap. - The
conf/config.ini
file must have theuse_timemap
variable set totrue
.
Once this is done, the response Link:
headers from the TimeGate will contain two new relations among the other regular TimeGate responses:
<HOST/timemap/link/URI-R>; rel="timemap"; type="application/link-format"
<HOST/timemap/json/URI-R>; rel="timemap"; type="application/json"
Where HOST
is the base URI of the program and URI-R
is the URI of the Original Resource.
The first link will serve regular Memento TimeMaps with MIME
type application/link-format
.
The other link will serve JSON TimeMaps.
For example, suppose http://www.example.com/resourceA
is the URI-R of an Original Resource.
And suppose the TimeGate/TimeMap server's host
configuration is set to http://timegate.example.com
<
Then, HTTP responses from the TimeGate will include the following:
<http://timegate.example.com/timemap/link/http://www.example.com/resourceA>; rel="timemap"; type="application/link-format"
<http://timegate.example.com/timemap/json/http://www.example.com/resourceA>; rel="timemap"; type="application/json"
Custom error messages can be sent to the client using the custom exception module.
from errors.timegateerrors import HandlerError
For instance, a custom message with HTTP status 400
and body Custom error message
can be sent using:
raise HandlerError("Custom error message", status=400)
Raising a HandlerError will stop the request and not return any Memento to the client.