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 boolean
checkProcessable(javax.servlet.http.HttpServletResponse res)
void
processActualRequest(Translet translet)
Process a simple or actual CORS request.void
processPreflightRequest(Translet translet)
Process a preflight CORS request.protected void
rejectRequest(Translet translet, CorsException ce)
Invoked when one of the CORS checks failed.void
sendError(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(Translet translet) throws CorsException
Description copied from interface:CorsProcessor
Process a simple or actual CORS request.- Parameters:
translet
- the Translet instance- Throws:
CorsException
- if the request is invalid or denied
-
processPreflightRequest
public void processPreflightRequest(Translet translet) throws CorsException
Description copied from interface:CorsProcessor
Process 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(Translet translet) throws java.io.IOException
Description copied from interface:CorsProcessor
Sends 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(Translet translet, CorsException ce) throws CorsException
Invoked 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)
-
-