Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

jakarta allow cross origins

@GET
@Path("/")
@Produces({MediaType.TEXT_PLAIN})
public Response index() {
    return Response
      .status(200)
      .header("Access-Control-Allow-Origin", "*")
      .header("Access-Control-Allow-Credentials", "true")
      .header("Access-Control-Allow-Headers",
        "origin, content-type, accept, authorization")
      .header("Access-Control-Allow-Methods", 
        "GET, POST, PUT, DELETE, OPTIONS, HEAD")
      .entity("")
      .build();
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #jakarta #cross #origins
ADD COMMENT
Topic
Name
5+7 =