Package com.aspectran.web.support.cors
Class DefaultCorsProcessor
- java.lang.Object
-
- com.aspectran.web.support.cors.AbstractCorsProcessor
-
- com.aspectran.web.support.cors.DefaultCorsProcessor
-
- All Implemented Interfaces:
CorsProcessor
public class DefaultCorsProcessor extends AbstractCorsProcessor
Process an incoming cross-origin (CORS) requests. Encapsulates the CORS processing logic as specified by the W3C candidate recommendation from 2013-01-29.- Since:
- 2.3.0
-
-
Constructor Summary
Constructors Constructor Description DefaultCorsProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckProcessable(javax.servlet.http.HttpServletResponse res)voidprocessActualRequest(com.aspectran.core.activity.Translet translet)Process a simple or actual CORS request.voidprocessPreflightRequest(com.aspectran.core.activity.Translet translet)Process a preflight CORS request.protected voidrejectRequest(com.aspectran.core.activity.Translet translet, CorsException ce)Invoked when one of the CORS checks failed.voidsendError(com.aspectran.core.activity.Translet translet)Sends an error response to the client using the specified status.-
Methods inherited from class com.aspectran.web.support.cors.AbstractCorsProcessor
containsMethod, getAllowedHeaders, getAllowedHeadersString, getAllowedMethods, getAllowedMethodsString, getAllowedOrigins, getExposedHeaders, getExposedHeadersString, getMaxAgeSeconds, hasAllowedHeaders, hasAllowedMethods, hasAllowedOrigins, hasExposedHeaders, isAllowCredentials, isAllowedHeader, isAllowedMethod, isAllowedOrigin, isCorsRequest, isPreFlightRequest, setAllowCredentials, setAllowedHeaders, setAllowedHeaders, setAllowedHeaders, setAllowedMethods, setAllowedMethods, setAllowedMethods, setAllowedOrigins, setAllowedOrigins, setAllowedOrigins, setExposedHeaders, setExposedHeaders, setExposedHeaders, setMaxAgeSeconds
-
-
-
-
Method Detail
-
processActualRequest
public void processActualRequest(com.aspectran.core.activity.Translet translet) throws CorsExceptionDescription copied from interface:CorsProcessorProcess a simple or actual CORS request.- Parameters:
translet- the Translet instance- Throws:
CorsException- if the request is invalid or denied
-
processPreflightRequest
public void processPreflightRequest(com.aspectran.core.activity.Translet translet) throws CorsExceptionDescription copied from interface:CorsProcessorProcess a preflight CORS request.CORS specification: PreflightRequest
- Parameters:
translet- the Translet instance- Throws:
CorsException- if the request is invalid or denied
-
sendError
public void sendError(com.aspectran.core.activity.Translet translet) throws java.io.IOExceptionDescription copied from interface:CorsProcessorSends an error response to the client using the specified status.- Parameters:
translet- the Translet instance- Throws:
java.io.IOException- in case of I/O errors
-
rejectRequest
protected void rejectRequest(com.aspectran.core.activity.Translet translet, CorsException ce) throws CorsExceptionInvoked when one of the CORS checks failed. The default implementation sets the response status to 403.- Parameters:
translet- the Translet instancece- the CORS Exception- Throws:
CorsException- if the request is denied
-
checkProcessable
protected boolean checkProcessable(javax.servlet.http.HttpServletResponse res)
-
-