public class ControllerUtils extends Object
| Constructor and Description |
|---|
ControllerUtils() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAccessControlHeaders(javax.servlet.http.HttpServletResponse response)
Add the access control headers to the response, allowing origin '*', methods 'POST' and max age
'1000'
|
void |
addCharacterEncoding(javax.servlet.http.HttpServletResponse response)
Add the 'UTF-8' character encoding to the response
|
void |
addResponseHeaders(javax.servlet.http.HttpServletResponse response)
Bundling method for adding both
character encoding
and access control headers to the response with
one call |
LimitResponse |
checkLimit(String wskey,
String url,
eu.europeana.corelib.db.entity.enums.RecordType recordType,
String profile)
Check the number requests made to the API in the last (rolling) 24 hours.
|
public LimitResponse checkLimit(String wskey, String url, eu.europeana.corelib.db.entity.enums.RecordType recordType, String profile) throws ApiLimitException
NOTE: This functionality has currently been disabled (ticket #1742); this method now always returns the user's apikey and a request number of '999' (unless it's a unregistered user).
wskey - The user's API web service keyurl - The requested URLapiCall - The REST endpoint of the callrecordType - The type of record, defined by RecordTypeprofile - The profile usedLimitResponse consisting of the apiKey and current request number{@link - ApiLimitException} if an unregistered or unauthorised key is provided, or if the
daily limit has been reachedApiLimitExceptionpublic void addResponseHeaders(javax.servlet.http.HttpServletResponse response)
character encoding
and access control headers to the response with
one callresponse - The response to add the encoding and headers topublic void addCharacterEncoding(javax.servlet.http.HttpServletResponse response)
response - The response to add the character encoding topublic void addAccessControlHeaders(javax.servlet.http.HttpServletResponse response)
response - The response to add access control headers toCopyright © 2017. All rights reserved.