Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mandacaru4.filter;
- import java.io.IOException;
- import jakarta.ws.rs.container.ContainerRequestContext;
- import jakarta.ws.rs.container.ContainerResponseContext;
- import jakarta.ws.rs.container.ContainerResponseFilter;
- import jakarta.ws.rs.ext.Provider;
- @Provider
- public class CorsFilter implements ContainerResponseFilter {
- @Override
- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
- throws IOException {
- responseContext.getHeaders().add("Access-Control-Allow-Origin", "*");
- responseContext.getHeaders().add("Access-Control-Allow-Headers", "content-type");
- responseContext.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement