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:
fromOrigin(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(@NonNull HttpMethod httpMethod, @NonNull Map<@NonNull String, @NonNull Set<@NonNull String>> headers) Extracts a CORS non-preflight request representation from the given HTTP request data.fromOrigin(@NonNull HttpMethod httpMethod, @NonNull String origin) Acquires a CORS non-preflight request representation for the given HTTP request data.The HTTP method for this request.The HTTPOriginheader value for this request.inthashCode()toString()
-
Method Details
-
fromOrigin
Acquires a CORS non-preflight request representation for the given HTTP request data. -
fromHeaders
public static @NonNull Optional<Cors> fromHeaders(@NonNull HttpMethod httpMethod, @NonNull Map<@NonNull String, @NonNull Set<@NonNull 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
-