qbit/core/src/main/java/io/advantageous/qbit/http/server/CorsResponseDecorator.java
protected CORSRequestType checkRequestType(final HttpRequestHolder request) {
        CORSRequestType requestType = CORSRequestType.INVALID_CORS;
        if (request == null) {
            throw new IllegalArgumentException(CorsSupport.CORS_NULL_REQUEST);
        }
        String originHeader = request.getHeaders().get(REQUEST_HEADER_ORIGIN);
        // Section 6.1.1 and Section 6.2.1
        if (originHeader != null) {
            if (originHeader.isEmpty()) {
                requestType = CORSRequestType.INVALID_CORS;
            } else if (!isValidOrigin(originHeader)) {
                requestType = CORSRequestType.INVALID_CORS;
            } else if (isLocalOrigin(request, originHeader)) {
                return CORSRequestType.NOT_CORS;
            } else {
                String method = request.getMethod();
                if (method != null) {
                    if ("OPTIONS".equals(method)) {
                        String accessControlRequestMethodHeader =
                                request.getHeaders().get(
                                        REQUEST_HEADER_ACCESS_CONTROL_REQUEST_METHOD);
                        if (accessControlRequestMethodHeader != null &&
                                !accessControlRequestMethodHeader.isEmpty()) {
                            requestType = CORSRequestType.PRE_FLIGHT;
                        } else if (accessControlRequestMethodHeader != null &&
                                accessControlRequestMethodHeader.isEmpty()) {
                            requestType = CORSRequestType.INVALID_CORS;
                        } else {
                            requestType = CORSRequestType.ACTUAL;
                        }
                    } else if ("GET".equals(method) || "HEAD".equals(method)) {
                        requestType = CORSRequestType.SIMPLE;
                    } else if ("POST".equals(method)) {
                        String mediaType = request.getContentType();
                        if (mediaType != null) {
//                                if (SIMPLE_HTTP_REQUEST_CONTENT_TYPE_VALUES
//                                        .contains(mediaType)) {
//                                    requestType = CORSRequestType.SIMPLE;
//                                } else {
//                                    requestType = CORSRequestType.ACTUAL;
//                                }

                            //TODO: Will QBit support non-simple?
                            requestType = CORSRequestType.SIMPLE;
                        }
                    } else {
                        requestType = CORSRequestType.ACTUAL;
                    }
                }
            }
        } else {
            requestType = CORSRequestType.NOT_CORS;
        }

        return requestType;
    }
protected CORSRequestType checkRequestType(final HttpRequestHolder request) {
        CORSRequestType requestType = CORSRequestType.INVALID_CORS;
        if (request == null) {
            throw new IllegalArgumentException(CorsSupport.CORS_NULL_REQUEST);
        }
        String originHeader = request.getHeaders().get(REQUEST_HEADER_ORIGIN);
        // Section 6.1.1 and Section 6.2.1
        if (originHeader != null) {
            if (originHeader.isEmpty()) {
                requestType = CORSRequestType.INVALID_CORS;
            } else if (!isValidOrigin(originHeader)) {
                requestType = CORSRequestType.INVALID_CORS;
            } else if (isLocalOrigin(request, originHeader)) {
                return CORSRequestType.NOT_CORS;
            } else {
                String method = request.getMethod();
                if (method != null) {
                    if ("OPTIONS".equals(method)) {
                        String accessControlRequestMethodHeader =
                                request.getHeaders().get(
                                        REQUEST_HEADER_ACCESS_CONTROL_REQUEST_METHOD);
                        if (accessControlRequestMethodHeader != null &&
                                !accessControlRequestMethodHeader.isEmpty()) {
                            requestType = CORSRequestType.PRE_FLIGHT;
                        } else if (accessControlRequestMethodHeader != null &&
                                accessControlRequestMethodHeader.isEmpty()) {
                            requestType = CORSRequestType.INVALID_CORS;
                        } else {
                            requestType = CORSRequestType.ACTUAL;
                        }
                    } else if ("GET".equals(method) || "HEAD".equals(method)) {
                        requestType = CORSRequestType.SIMPLE;
                    } else if ("POST".equals(method)) {
                        String mediaType = request.getContentType();
                        if (mediaType != null) {
//                                if (SIMPLE_HTTP_REQUEST_CONTENT_TYPE_VALUES
//                                        .contains(mediaType)) {
//                                    requestType = CORSRequestType.SIMPLE;
//                                } else {
//                                    requestType = CORSRequestType.ACTUAL;
//                                }

                            //TODO: Will QBit support non-simple?
                            requestType = CORSRequestType.SIMPLE;
                        }
                    } else {
                        requestType = CORSRequestType.ACTUAL;
                    }
                }
            }
        } else {
            requestType = CORSRequestType.NOT_CORS;
        }

        return requestType;
    }
protected CORSRequestType checkRequestType ( final HttpRequestHolder request ) { CORSRequestType requestType = CORSRequestType . INVALID_CORS ; if ( request == null ) { throw new IllegalArgumentException ( CorsSupport . CORS_NULL_REQUEST ) ; } String originHeader = request . getHeaders ( ) . get ( REQUEST_HEADER_ORIGIN ) ; // Section 6.1.1 and Section 6.2.1 if ( originHeader != null ) { if ( originHeader . isEmpty ( ) ) { requestType = CORSRequestType . INVALID_CORS ; } else if ( ! isValidOrigin ( originHeader ) ) { requestType = CORSRequestType . INVALID_CORS ; } else if ( isLocalOrigin ( request , originHeader ) ) { return CORSRequestType . NOT_CORS ; } else { String method = request . getMethod ( ) ; if ( method != null ) { if ( "OPTIONS" . equals ( method ) ) { String accessControlRequestMethodHeader = request . getHeaders ( ) . get ( REQUEST_HEADER_ACCESS_CONTROL_REQUEST_METHOD ) ; if ( accessControlRequestMethodHeader != null && ! accessControlRequestMethodHeader . isEmpty ( ) ) { requestType = CORSRequestType . PRE_FLIGHT ; } else if ( accessControlRequestMethodHeader != null && accessControlRequestMethodHeader . isEmpty ( ) ) { requestType = CORSRequestType . INVALID_CORS ; } else { requestType = CORSRequestType . ACTUAL ; } } else if ( "GET" . equals ( method ) || "HEAD" . equals ( method ) ) { requestType = CORSRequestType . SIMPLE ; } else if ( "POST" . equals ( method ) ) { String mediaType = request . getContentType ( ) ; if ( mediaType != null ) { //                                if (SIMPLE_HTTP_REQUEST_CONTENT_TYPE_VALUES //                                        .contains(mediaType)) { //                                    requestType = CORSRequestType.SIMPLE; //                                } else { //                                    requestType = CORSRequestType.ACTUAL; //                                } //TODO: Will QBit support non-simple? requestType = CORSRequestType . SIMPLE ; } } else { requestType = CORSRequestType . ACTUAL ; } } } } else { requestType = CORSRequestType . NOT_CORS ; } return requestType ; }
Determines the request type.

@param request request
@return CORs request type.
Determines the request type .