Package io.muserver.rest
Class CORSConfig
- java.lang.Object
-
- io.muserver.rest.CORSConfig
-
public class CORSConfig extends java.lang.Object
CORS configuration for REST resources. Create this usingCORSConfigBuilder.corsConfig()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowCredentials()
java.util.Collection<java.lang.String>
allowedHeaders()
java.util.List<java.util.regex.Pattern>
allowedOriginRegex()
java.util.Collection<java.lang.String>
allowedOrigins()
boolean
equals(java.lang.Object o)
java.util.Collection<java.lang.String>
exposedHeaders()
int
hashCode()
long
maxAge()
java.lang.String
toString()
boolean
writeHeaders(MuRequest request, MuResponse response, java.util.Set<Method> allowedMethods)
Adds CORS headers to the response, if needed.
-
-
-
Method Detail
-
writeHeaders
public boolean writeHeaders(MuRequest request, MuResponse response, java.util.Set<Method> allowedMethods)
Adds CORS headers to the response, if needed.- Parameters:
request
- The requestresponse
- The response to add headers toallowedMethods
- The methods- Returns:
- Returns true if any Access Control headers were added; otherwise false. (Note: the
Vary: origin
header is always added.
-
allowCredentials
public boolean allowCredentials()
- Returns:
- the value described by
CORSConfigBuilder.withAllowCredentials(boolean)
-
allowedOrigins
public java.util.Collection<java.lang.String> allowedOrigins()
- Returns:
- the value described by
CORSConfigBuilder.withAllowedOrigins(java.util.Collection<java.lang.String>)
-
allowedOriginRegex
public java.util.List<java.util.regex.Pattern> allowedOriginRegex()
- Returns:
- the value described by
CORSConfigBuilder.withAllowedOriginRegex(java.util.regex.Pattern)
-
exposedHeaders
public java.util.Collection<java.lang.String> exposedHeaders()
- Returns:
- the value described by
CORSConfigBuilder.withExposedHeaders(java.lang.String...)
-
maxAge
public long maxAge()
- Returns:
- the value described by
CORSConfigBuilder.withMaxAge(long)
-
allowedHeaders
public java.util.Collection<java.lang.String> allowedHeaders()
- Returns:
- the value described by
CORSConfigBuilder.withAllowedHeaders(java.lang.String...)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-