Package org.trellisldp.dropwizard
Class CrossOriginResourceSharingFilter
- java.lang.Object
-
- org.trellisldp.dropwizard.CrossOriginResourceSharingFilter
-
- All Implemented Interfaces:
ContainerResponseFilter
@Provider public class CrossOriginResourceSharingFilter extends Object implements ContainerResponseFilter
AContainerResponseFilter
that adds CORS-related headers to HTTP responses.- See Also:
- Cross-Origin Resource Sharing
-
-
Constructor Summary
Constructors Constructor Description CrossOriginResourceSharingFilter(Collection<String> origins, Collection<String> allowedMethods, Collection<String> allowedHeaders, Collection<String> exposedHeaders, boolean credentials, int cacheSeconds)
Create a CORS filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
filter(ContainerRequestContext req, ContainerResponseContext res)
-
-
-
Constructor Detail
-
CrossOriginResourceSharingFilter
public CrossOriginResourceSharingFilter(Collection<String> origins, Collection<String> allowedMethods, Collection<String> allowedHeaders, Collection<String> exposedHeaders, boolean credentials, int cacheSeconds)
Create a CORS filter.- Parameters:
origins
- a collection of allowed origin valuesallowedMethods
- a collection of allowed methodsallowedHeaders
- a collection of allowed headersexposedHeaders
- a collection of exposed headerscredentials
- true if the Access-Control-Allow-Credentials header is to be setcacheSeconds
- set this to a value greater than zero to set the Access-Control-Max-Age header
-
-
Method Detail
-
filter
public void filter(ContainerRequestContext req, ContainerResponseContext res)
- Specified by:
filter
in interfaceContainerResponseFilter
-
-