code: public RestBuilder enableCors(String allowedOriginPattern,
  	                              boolean allowCredentials,
  	                              int maxAge,
  	                              Set<String> allowedHeaders,
  	                              HttpMethod... methods) {
  
  		corsHandler = CorsHandler.create(allowedOriginPattern)
  		                         .allowCredentials(allowCredentials)
  		                         .maxAgeSeconds(maxAge);
  
  		if (methods == null || methods.length == 0) { // if not given than all
  			methods = HttpMethod.values();
  		}
  
  		for (HttpMethod method : methods) {
  			corsHandler.allowedMethod(method);
  		}
  
  		if (allowedHeaders.size() > 0) {
  			corsHandler.allowedHeaders(allowedHeaders);
  		}
  
  		return this;
  	}
docs: Enables CORS
  
  @param allowedOriginPattern allowed origin
  @param allowCredentials     allow credentials (true/false)
  @param maxAge               in seconds
  @param allowedHeaders       set of allowed headers
  @param methods              list of methods ... if empty all methods are allowed  @return self
  @return self