Package org.trellisldp.dropwizard.config
Class CORSConfiguration
- java.lang.Object
-
- org.trellisldp.dropwizard.config.CORSConfiguration
-
public class CORSConfiguration extends Object
Configuration for CORS headers.
-
-
Constructor Summary
Constructors Constructor Description CORSConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetAllowCredentials()Get the value of Allow-Credentials.List<String>getAllowHeaders()Get a list of allowed headers.List<String>getAllowMethods()Get a list of allowed methods.List<String>getAllowOrigin()Get a list of allowed origins.booleangetEnabled()Get whether CORS has been enabled.List<String>getExposeHeaders()Get a list of exposed headers.intgetMaxAge()Get the Max-Age header.voidsetAllowCredentials(boolean allowCredentials)Control whether Allow-Credentials should be displayed.voidsetAllowHeaders(List<String> headers)Set the allowed headers.voidsetAllowMethods(List<String> methods)Set the allowed methods.voidsetAllowOrigin(List<String> origins)Set the allowed origins.voidsetEnabled(boolean enabled)Enable or disable CORS.voidsetExposeHeaders(List<String> headers)Set the exposed headers.voidsetMaxAge(int maxAge)Set the Max-Age header.
-
-
-
Method Detail
-
getEnabled
public boolean getEnabled()
Get whether CORS has been enabled.- Returns:
- true if CORS is enabled; false otherwise
-
setEnabled
public void setEnabled(boolean enabled)
Enable or disable CORS.- Parameters:
enabled- true if CORS is enabled; false otherwise
-
getAllowOrigin
public List<String> getAllowOrigin()
Get a list of allowed origins.- Returns:
- the Allow-Origin values
-
setAllowOrigin
public void setAllowOrigin(List<String> origins)
Set the allowed origins.- Parameters:
origins- the origins
-
getAllowMethods
public List<String> getAllowMethods()
Get a list of allowed methods.- Returns:
- the Allow-Methods values
-
setAllowMethods
public void setAllowMethods(List<String> methods)
Set the allowed methods.- Parameters:
methods- the methods
-
getAllowHeaders
public List<String> getAllowHeaders()
Get a list of allowed headers.- Returns:
- the Allow-Headers values
-
setAllowHeaders
public void setAllowHeaders(List<String> headers)
Set the allowed headers.- Parameters:
headers- the allowed headers
-
getExposeHeaders
public List<String> getExposeHeaders()
Get a list of exposed headers.- Returns:
- the Expose-Header values
-
setExposeHeaders
public void setExposeHeaders(List<String> headers)
Set the exposed headers.- Parameters:
headers- the exposed headers
-
getMaxAge
public int getMaxAge()
Get the Max-Age header.- Returns:
- the Max-Age header
-
setMaxAge
public void setMaxAge(int maxAge)
Set the Max-Age header.- Parameters:
maxAge- the max age
-
getAllowCredentials
public boolean getAllowCredentials()
Get the value of Allow-Credentials.- Returns:
- true if Allow-Credentials is set; false otherwise
-
setAllowCredentials
public void setAllowCredentials(boolean allowCredentials)
Control whether Allow-Credentials should be displayed.- Parameters:
allowCredentials- true if Allow-Credentials should be included; false otherwise
-
-