public class CrossOriginResourceSharingFilter extends Object implements RequestHandler, ResponseHandler
| Constructor and Description |
|---|
CrossOriginResourceSharingFilter() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getAllowHeaders() |
List<String> |
getAllowOrigins() |
List<String> |
getExposeHeaders() |
Integer |
getMaxAge() |
javax.ws.rs.core.Response |
handleRequest(Message m,
ClassResourceInfo resourceClass) |
javax.ws.rs.core.Response |
handleResponse(Message m,
OperationResourceInfo ori,
javax.ws.rs.core.Response response) |
boolean |
isAllowCredentials() |
boolean |
isDefaultOptionsMethodsHandlePreflight() |
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 |
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 |
setMaxAge(Integer maxAge)
The value for Access-Control-Max-Age.
|
void |
setPreflightErrorStatus(Integer status)
Preflight error response status, default is 200.
|
public javax.ws.rs.core.Response handleRequest(Message m, ClassResourceInfo resourceClass)
handleRequest in interface RequestHandlerpublic javax.ws.rs.core.Response handleResponse(Message m, OperationResourceInfo ori, javax.ws.rs.core.Response response)
handleResponse in interface ResponseHandlerpublic 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 boolean isDefaultOptionsMethodsHandlePreflight()
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.Apache CXF