* A default options action that implements access control policy.
*
* @return the response
*/
public WOActionResults optionsAction() throws Throwable {
ERXResponse response = new ERXResponse();
String accessControlAllowOrigin = accessControlAllowOrigin();
if (accessControlAllowOrigin != null) {
response.setHeader(accessControlAllowOrigin, "Access-Control-Allow-Origin");
NSArray<String> accessControlAllowRequestMethods = accessControlAllowRequestMethods(request().headerForKey("Access-Control-Request-Method"));
if (accessControlAllowRequestMethods != null) {
response.setHeader(accessControlAllowRequestMethods.componentsJoinedByString(","), "Access-Control-Allow-Methods");
}
String requestHeadersStr = request().headerForKey("Access-Control-Request-Headers");
NSArray<String> requestHeaders = (requestHeadersStr == null) ? null : NSArray.componentsSeparatedByString(requestHeadersStr, ",");
NSArray<String> accessControlAllowRequestHeaders = accessControlAllowRequestHeaders(requestHeaders);
if (accessControlAllowRequestHeaders != null) {
response.setHeader(accessControlAllowRequestHeaders.componentsJoinedByString(","), "Access-Control-Allow-Headers");
}
long accessControlMaxAge = accessControlMaxAage();
if (accessControlMaxAge >= 0) {
response.setHeader(String.valueOf(accessControlMaxAge), "Access-Control-Max-Age");
}
}
return response;
}