@Provider @PreMatching @Priority(value=999) public class CrossOriginResourceSharingFilter extends Object implements javax.ws.rs.container.ContainerRequestFilter, javax.ws.rs.container.ContainerResponseFilter
Constructor and Description |
---|
CrossOriginResourceSharingFilter() |
Modifier and Type | Method and Description |
---|---|
void |
filter(javax.ws.rs.container.ContainerRequestContext context) |
void |
filter(javax.ws.rs.container.ContainerRequestContext requestContext,
javax.ws.rs.container.ContainerResponseContext responseContext) |
List<String> |
getAllowHeaders() |
List<String> |
getAllowOrigins() |
List<String> |
getExposeHeaders() |
Integer |
getMaxAge() |
boolean |
isAllowCredentials() |
void |
setAllowCredentials(boolean allowCredentials)
The value for the Access-Control-Allow-Credentials header.
|
void |
setAllowHeaders(List<String> allowedHeaders)
The list of allowed headers for preflight checks.
|
void |
setAllowOrigins(List<String> allowedOrigins)
The origin strings to allow.
|
void |
setBlockCorsIfUnauthorized(boolean blockCorsIfUnauthorized) |
void |
setDefaultOptionsMethodsHandlePreflight(boolean defaultOptionsMethodsHandlePreflight)
What to do when a preflight request comes along for a resource that has a handler method for
\@OPTIONS and there is no @
CrossResourceSharing (localPreflight = val)
annotation on the method. |
void |
setExposeHeaders(List<String> exposeHeaders)
A list of non-simple headers to be exposed via Access-Control-Expose-Headers.
|
void |
setFindResourceMethod(boolean findResourceMethod) |
void |
setMaxAge(Integer maxAge)
The value for Access-Control-Max-Age.
|
void |
setPreflightErrorStatus(Integer status)
Preflight error response status, default is 200.
|
public void filter(javax.ws.rs.container.ContainerRequestContext context)
filter
in interface javax.ws.rs.container.ContainerRequestFilter
public void filter(javax.ws.rs.container.ContainerRequestContext requestContext, javax.ws.rs.container.ContainerResponseContext responseContext)
filter
in interface javax.ws.rs.container.ContainerResponseFilter
public void setAllowOrigins(List<String> allowedOrigins)
allowedOrigins
- a list of case-sensitive origin strings.public void setAllowHeaders(List<String> allowedHeaders)
allowedHeaders
- a list of permitted headers.public Integer getMaxAge()
public boolean isAllowCredentials()
public void setAllowCredentials(boolean allowCredentials)
allowCredentials
- public void setExposeHeaders(List<String> exposeHeaders)
exposeHeaders
- the list of (case-sensitive) header names.public void setMaxAge(Integer maxAge)
maxAge
- An integer 'delta-seconds' or null. If null, no header is added.public void setPreflightErrorStatus(Integer status)
status
- HTTP status code.public void setDefaultOptionsMethodsHandlePreflight(boolean defaultOptionsMethodsHandlePreflight)
CrossResourceSharing
(localPreflight = val)
annotation on the method. If this is true, then the filter
defers to the resource class method.
If this is false, then this filter performs preflight processing.defaultOptionsMethodsHandlePreflight
- true to defer to resource methods.public void setFindResourceMethod(boolean findResourceMethod)
public void setBlockCorsIfUnauthorized(boolean blockCorsIfUnauthorized)
Apache CXF