Interface CorsUtils


public interface CorsUtils
Utility class for CORS request handling based on the W3.
Since:
2.0.7
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The CORS Access-Control-Request-Method request header field name.
    static final String
     
    static final String
    The HTTP Origin header field name.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static boolean
    isPreFlightRequest(javax.servlet.http.HttpServletRequest request)
    Determines whether the given HttpServletRequest represents a CORS preflight request.
  • Field Details

  • Method Details

    • isPreFlightRequest

      static boolean isPreFlightRequest(javax.servlet.http.HttpServletRequest request)
      Determines whether the given HttpServletRequest represents a CORS preflight request.

      A CORS preflight request is an OPTIONS request sent by browsers before the actual cross-origin request, to verify that the target server allows the actual request's method and headers.

      This method returns true if and only if:

      • The HTTP method is OPTIONS,
      • The Origin header is present, and
      • The Access-Control-Request-Method header is present.
      Parameters:
      request - the incoming HTTP request to inspect (must not be null)
      Returns:
      true if the request is a valid CORS preflight request; false otherwise