类 DefaultCorsProcessor
java.lang.Object
cn.taketoday.web.cors.DefaultCorsProcessor
- 所有已实现的接口:
CorsProcessor
The default implementation of
CorsProcessor, as defined by the
CORS W3C recommendation.
Note that when input CorsConfiguration is null, this
implementation does not reject simple or actual requests outright but simply
avoid adding CORS headers to the response. CORS processing is also skipped if
the response already contains CORS headers.
- 作者:
- Sebastien Deleuze, Rossen Stoyanchev, TODAY 2019-12-23 21:02
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明checkHeaders(CorsConfiguration config, List<String> requestHeaders) Check the headers and determine the headers for the response of a pre-flight request.protected List<HttpMethod>checkMethods(CorsConfiguration config, HttpMethod method) Check the HTTP method and determine the methods for the response of a pre-flight request.protected StringcheckOrigin(CorsConfiguration config, String requestOrigin) Check the origin and determine the origin for the response.getHeadersToUse(RequestContext context, boolean isPreFlight) private HttpMethodgetMethodToUse(RequestContext request, boolean isPreFlight) protected booleanhandleInternal(RequestContext context, CorsConfiguration config, boolean preFlightRequest) Handle the given request.booleanprocess(CorsConfiguration config, RequestContext context) Process a request given aCorsConfiguration.protected voidrejectRequest(RequestContext context) Invoked when one of the CORS checks failed.
-
字段详细资料
-
log
private static final cn.taketoday.logging.Logger log
-
-
构造器详细资料
-
DefaultCorsProcessor
public DefaultCorsProcessor()
-
-
方法详细资料
-
process
public boolean process(@Nullable CorsConfiguration config, RequestContext context) throws IOException 从接口复制的说明:CorsProcessorProcess a request given aCorsConfiguration.- 指定者:
process在接口中CorsProcessor- 参数:
config- the applicable CORS configuration (possiblynull)context- the current HTTP context- 返回:
falseif the request is rejected,trueotherwise- 抛出:
IOException
-
rejectRequest
Invoked when one of the CORS checks failed. The default implementation sets the response status to 403 and writes "Invalid CORS request" to the response.- 抛出:
IOException
-
handleInternal
protected boolean handleInternal(RequestContext context, CorsConfiguration config, boolean preFlightRequest) throws IOException Handle the given request.- 抛出:
IOException
-
checkOrigin
Check the origin and determine the origin for the response. The default implementation simply delegates toCorsConfiguration.checkOrigin(String). -
checkMethods
@Nullable protected List<HttpMethod> checkMethods(CorsConfiguration config, @Nullable HttpMethod method) Check the HTTP method and determine the methods for the response of a pre-flight request. The default implementation simply delegates toCorsConfiguration.checkOrigin(String). -
getMethodToUse
-
checkHeaders
@Nullable protected List<String> checkHeaders(CorsConfiguration config, List<String> requestHeaders) Check the headers and determine the headers for the response of a pre-flight request. The default implementation simply delegates toCorsConfiguration.checkHeaders(java.util.List<java.lang.String>). -
getHeadersToUse
-