Class ResponseCorsMiddleware
java.lang.Object
com.networknt.aws.lambda.handler.middleware.cors.ResponseCorsMiddleware
- All Implemented Interfaces:
LambdaHandler,MiddlewareHandler
This middleware is responsible for adding CORS headers to the response if the request is a CORS request.
It means the request has a header Origin. The middleware will add the following headers to the response:
Access-Control-Allow-Origin: The value of the Origin header
Access-Control-Allow-Methods: The value of the Access-Control-Request-Method header
- Author:
- Steve Hu
-
Field Summary
Fields inherited from interface com.networknt.aws.lambda.handler.LambdaHandler
DISABLED_LAMBDA_HANDLER_RETURN, SUCCESS_LAMBDA_HANDLER_RETURN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.networknt.status.Statusexecute(LightLambdaExchange exchange) voidbooleanIndicate if this middleware handler is asynchronous or not.booleanIndicate if this middleware handler is audited or not.booleanIndicate if this middleware handler will continue on failure or not.booleanIndicate if this handler is enabled or not.booleanvoidregister()Register this handler to the handler registration.voidreload()Reload config values in case the config values changed by config server.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.networknt.aws.lambda.handler.LambdaHandler
disabledMiddlewareStatus, successMiddlewareStatus
-
Constructor Details
-
ResponseCorsMiddleware
public ResponseCorsMiddleware() -
ResponseCorsMiddleware
public ResponseCorsMiddleware(com.networknt.cors.CorsConfig cfg)
-
-
Method Details
-
execute
- Specified by:
executein interfaceLambdaHandler
-
isEnabled
public boolean isEnabled()Description copied from interface:LambdaHandlerIndicate if this handler is enabled or not.- Specified by:
isEnabledin interfaceLambdaHandler- Returns:
- boolean true if enabled
-
register
public void register()Description copied from interface:LambdaHandlerRegister this handler to the handler registration.- Specified by:
registerin interfaceLambdaHandler
-
reload
public void reload()Description copied from interface:LambdaHandlerReload config values in case the config values changed by config server.- Specified by:
reloadin interfaceLambdaHandler
-
isAsynchronous
public boolean isAsynchronous()Description copied from interface:LambdaHandlerIndicate if this middleware handler is asynchronous or not.- Specified by:
isAsynchronousin interfaceLambdaHandler- Returns:
- boolean true if asynchronous
-
isResponseMiddleware
public boolean isResponseMiddleware()- Specified by:
isResponseMiddlewarein interfaceLambdaHandler
-
isContinueOnFailure
public boolean isContinueOnFailure()Description copied from interface:MiddlewareHandlerIndicate if this middleware handler will continue on failure or not.- Specified by:
isContinueOnFailurein interfaceMiddlewareHandler- Returns:
- boolean true if continue on failure
-
isAudited
public boolean isAudited()Description copied from interface:MiddlewareHandlerIndicate if this middleware handler is audited or not.- Specified by:
isAuditedin interfaceMiddlewareHandler- Returns:
- boolean true if audited
-
getCachedConfigurations
public void getCachedConfigurations()- Specified by:
getCachedConfigurationsin interfaceMiddlewareHandler
-