Class Cors
java.lang.Object
com.soklet.Cors
Encapsulates non-preflight CORS HTTP request data.
Data for preflight requests is represented by CorsPreflight.
Instances can be acquired via these factory methods:
withOrigin(HttpMethod, String)(usesOriginheader value)fromHeaders(HttpMethod, Map)(parses raw headers)
See https://www.soklet.com/docs/cors for detailed documentation.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbooleanfromHeaders(HttpMethod httpMethod, Map<String, Set<String>> headers) Extracts a CORS non-preflight request representation from the given HTTP request data.The HTTP method for this request.The HTTPOriginheader value for this request.inthashCode()toString()static CorswithOrigin(HttpMethod httpMethod, String origin) Acquires a CORS non-preflight request representation for the given HTTP request data.
-
Method Details
-
withOrigin
Acquires a CORS non-preflight request representation for the given HTTP request data. -
fromHeaders
@Nonnull public static Optional<Cors> fromHeaders(@Nonnull HttpMethod httpMethod, @Nonnull Map<String, Set<String>> headers) Extracts a CORS non-preflight request representation from the given HTTP request data.- Parameters:
httpMethod- the request's HTTP methodheaders- the request headers- Returns:
- the CORS non-preflight data for this request, or
Optional.empty()if insufficent data is present
-
toString
-
equals
-
hashCode
-
getHttpMethod
The HTTP method for this request.- Returns:
- the HTTP method
-
getOrigin
-