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()
-
-
Field Summary
Fields Modifier and Type Field Description boolean
allowCredentials
Deprecated.useallowCredentials()
insteadjava.util.Collection<java.lang.String>
allowedHeaders
Deprecated.useallowedHeaders()
insteadjava.util.List<java.util.regex.Pattern>
allowedOriginRegex
Deprecated.useallowedOriginRegex()
insteadjava.util.Collection<java.lang.String>
allowedOrigins
Deprecated.useallowedOrigins()
insteadjava.util.Collection<java.lang.String>
exposedHeaders
Deprecated.useexposedHeaders()
insteadlong
maxAge
Deprecated.usemaxAge()
instead
-
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.
-
-
-
Field Detail
-
allowCredentials
@Deprecated public final boolean allowCredentials
Deprecated.useallowCredentials()
instead
-
allowedOrigins
@Deprecated public final java.util.Collection<java.lang.String> allowedOrigins
Deprecated.useallowedOrigins()
instead
-
allowedOriginRegex
@Deprecated public final java.util.List<java.util.regex.Pattern> allowedOriginRegex
Deprecated.useallowedOriginRegex()
instead
-
exposedHeaders
@Deprecated public final java.util.Collection<java.lang.String> exposedHeaders
Deprecated.useexposedHeaders()
instead
-
maxAge
@Deprecated public final long maxAge
Deprecated.usemaxAge()
instead
-
allowedHeaders
@Deprecated public final java.util.Collection<java.lang.String> allowedHeaders
Deprecated.useallowedHeaders()
instead
-
-
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
-
-