Created
January 20, 2014 14:25
-
-
Save tganzarolli/8520728 to your computer and use it in GitHub Desktop.
A RestEasy service to return a default OK response for a CORS pre-flight request. Those requests are made when you are using CORS along with authentication headers. Using Jetty, the org.eclipse.jetty.servlets.CrossOriginFilter configured on the web.xml can take care of sending the required headers on the response. However, it does not care of re…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.ws.rs.OPTIONS; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; | |
import javax.ws.rs.core.Response; | |
import org.springframework.stereotype.Service; | |
@Produces(MediaType.APPLICATION_JSON) | |
@Path("/") | |
@Service | |
public class CorsPreFlightService { | |
@OPTIONS | |
@Path("/{var:.*}") | |
public Response defaultOptions() { | |
return ResponseObject.ok("").buildResponse(200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment