RequestUtil { public static String getCORSRequestedMethod( final ContainerRequestContext request) { MultivaluedMap<String, String> headers = request.getHeaders(); return headers .getFirst(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD); } private  RequestUtil(); static String getCORSRequestedMethod(
            final ContainerRequestContext request); static List<String> getCORSRequestedHeaders(
            final ContainerRequestContext request); static URI getOrigin(final ContainerRequestContext request); static URI getReferer(final ContainerRequestContext request); static URI getHost(final ContainerRequestContext request); static URI getForwardedHost(
            final ContainerRequestContext request); static Boolean isCrossOriginRequest(
            final ContainerRequestContext request);  }
@Test public void testCorsRequestedMethod() throws Exception { MultivaluedMap<String, String> headers = new MultivaluedHashMap<>(); headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "OPTIONS"); ContainerRequestContext mockContext = buildContext( "https: headers ); String method = RequestUtil.getCORSRequestedMethod(mockContext); assertEquals("OPTIONS", method); }
@Test public void testCorsRequestedMethodEmpty() throws Exception { MultivaluedMap<String, String> headers = new MultivaluedHashMap<>(); ContainerRequestContext mockContext = buildContext( "https: headers ); String method = RequestUtil.getCORSRequestedMethod(mockContext); assertNull(method); }