Extending your response when a request is throttled |
When throttling of requests is enabled for a Server, if the number of incoming requests exceeds the throttling limit, you will get a status code 429 and a message that the server is getting too many requests. You can add your own text to the default response message by using the functional type ThrottlingHook in a class. For example, if you want to inform the user that he can try again after a predefined time, you can add the "Retry-After" header. To achieve this:
Functional Type = ThrottlingHook Implemented Interfaces Names = com.usoft.uservice.server.IThrottlingHook
Your class could now look like this:
See also |