Class CORSHelper


  • public class CORSHelper
    extends Object
    This class provides util functions for all CORS related activities.
    • Constructor Detail

      • CORSHelper

        public CORSHelper()
    • Method Detail

      • getAllowedOrigins

        public static String getAllowedOrigins​(String origin,
                                               Set<String> allowedOrigins)
        Function to retrieve allowed origin header string
        Parameters:
        origin - Received origin
        allowedOrigins - allowed origin set
        Returns:
      • handleCORSHeaders

        public static void handleCORSHeaders​(CORSConfiguration corsConfiguration,
                                             MessageContext synCtx,
                                             String supportedMethods,
                                             boolean updateHeaders)
        Functions to handle CORS Headers
        Parameters:
        synCtx - Synapse message context
        corsConfiguration - of the API
        supportedMethods -
        updateHeaders - Boolean
      • handleCORSHeadersForResponse

        public static void handleCORSHeadersForResponse​(CORSConfiguration corsConfiguration,
                                                        MessageContext synCtx)
        Function to set CORS headers to response message transport headers extracting from synapse message context
        Parameters:
        synCtx -
        corsConfiguration - of the API