Class CorsUtils

java.lang.Object
org.springframework.web.cors.CorsUtils

public abstract class CorsUtils extends Object
Utility class for CORS request handling based on the CORS W3C recommendation.
Since:
4.2
Author:
Sebastien Deleuze
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isCorsRequest(jakarta.servlet.http.HttpServletRequest request)
    Returns true if the request is a valid CORS one by checking Origin header presence and ensuring that origins are different.
    static boolean
    isPreFlightRequest(jakarta.servlet.http.HttpServletRequest request)
    Returns true if the request is a valid CORS pre-flight one by checking OPTIONS method with Origin and Access-Control-Request-Method headers presence.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CorsUtils

      public CorsUtils()
  • Method Details

    • isCorsRequest

      public static boolean isCorsRequest(jakarta.servlet.http.HttpServletRequest request)
      Returns true if the request is a valid CORS one by checking Origin header presence and ensuring that origins are different.
    • isPreFlightRequest

      public static boolean isPreFlightRequest(jakarta.servlet.http.HttpServletRequest request)
      Returns true if the request is a valid CORS pre-flight one by checking OPTIONS method with Origin and Access-Control-Request-Method headers presence.