Package com.google.gerrit.httpd.restapi
Class CorsResponder
java.lang.Object
com.google.gerrit.httpd.restapi.CorsResponder
Provides methods for processing CORS requests.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkCors
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean isXd) Processes CORS request and add required headers to the response.boolean
filterCorsPreflight
(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) Responses to a CORS preflight request.static Pattern
makeAllowOrigin
(org.eclipse.jgit.lib.Config cfg)
-
Constructor Details
-
CorsResponder
-
-
Method Details
-
makeAllowOrigin
-
filterCorsPreflight
public boolean filterCorsPreflight(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws BadRequestException Responses to a CORS preflight request.If the request is a CORS preflight request, the method writes a correct preflight response and returns true. A further processing of the request is not required. Otherwise, the method returns false without adding anything to the response.
- Throws:
BadRequestException
-
checkCors
public void checkCors(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean isXd) throws BadRequestException Processes CORS request and add required headers to the response.The method checks if the incoming request is a CORS request and if so validates the request's origin.
- Throws:
BadRequestException
-