code: @Override
    public void service(RequestWeb request)
    {
      try {
        if (! request.method().equals("OPTIONS")) {
          request.ok();
          return;
        }
        
        if (_crossOrigin.allowCredentials())
          request.header(ALLOW_CREDENTIALS, "true");
  
        //allow-origin
        String[] origin = _crossOrigin.value();
  
        if (origin.length == 0)
          origin = _crossOrigin.allowOrigin();
  
        if (origin.length > 0)
          request.header(ALLOW_ORIGIN, join(origin));
  
        //allow methods
        HttpMethod[] methods = _crossOrigin.allowMethods();
  
        if (methods.length > 0) {
          request.header(ALLOW_METHODS, join(methods));
        }
        else if (_httpMethod != null) {
          request.header(ALLOW_METHODS, _httpMethod.toString());
        }
  
        //allow headers
        String[] allowHeaders = _crossOrigin.allowHeaders();
        if (allowHeaders.length > 0)
          request.header(ALLOW_HEADERS, join(allowHeaders));
  
        //expose headers
        String[] exposeHeaders = _crossOrigin.exposeHeaders();
        if (exposeHeaders.length > 0)
          request.header(EXPOSE_HEADERS, join(exposeHeaders));
  
        //max age
        request.header(MAX_AGE, Long.toString(_crossOrigin.maxAge()));
  
        request.ok();
        request.halt();
      } catch (Exception e) {
        log.log(Level.WARNING, e.toString(), e);
      }
    }
docs: Service a request.
  
  @param request the http request facade