Package org.apache.synapse.api.cors
Class CORSHelper
- java.lang.Object
-
- org.apache.synapse.api.cors.CORSHelper
-
public class CORSHelper extends Object
This class provides util functions for all CORS related activities.
-
-
Constructor Summary
Constructors Constructor Description CORSHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getAllowedOrigins(String origin, Set<String> allowedOrigins)
Function to retrieve allowed origin header stringstatic void
handleCORSHeaders(CORSConfiguration corsConfiguration, MessageContext synCtx, String supportedMethods, boolean updateHeaders)
Functions to handle CORS Headersstatic void
handleCORSHeadersForResponse(CORSConfiguration corsConfiguration, MessageContext synCtx)
Function to set CORS headers to response message transport headers extracting from synapse message context
-
-
-
Method Detail
-
getAllowedOrigins
public static String getAllowedOrigins(String origin, Set<String> allowedOrigins)
Function to retrieve allowed origin header string- Parameters:
origin
- Received originallowedOrigins
- 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 contextcorsConfiguration
- of the APIsupportedMethods
-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
-
-