Module io.helidon.cors
Package io.helidon.cors
Class CorsSupportBase<Q,R,T extends CorsSupportBase<Q,R,T,B>,B extends CorsSupportBase.Builder<Q,R,T,B>>
java.lang.Object
io.helidon.cors.CorsSupportBase<Q,R,T,B>
- Type Parameters:
Q
- request type wrapped by request adapterR
- response type wrapped by response adapterT
- concrete subclass ofCorsSupportBase
B
- builder for concrete type<T>
- Direct Known Subclasses:
CorsSupport
public abstract class CorsSupportBase<Q,R,T extends CorsSupportBase<Q,R,T,B>,B extends CorsSupportBase.Builder<Q,R,T,B>>
extends Object
A Helidon service and handler implementation that implements CORS, for both the application and for built-in Helidon
services (such as OpenAPI and metrics).
The caller can set up the CorsSupportBase
in a combination of these ways:
- from a
Config
node supplied programmatically, - from one or more
CrossOriginConfig
objects supplied programmatically, each associated with a path to which it applies, and - by setting individual CORS-related attributes on the
CorsSupportBase.Builder
(which affects the CORS behavior for the "{+}" path).
See the CorsSupportBase.Builder.build()
method for how the builder resolves conflicts among these sources.
If none of these sources is used, the CorsSupportBase
applies defaults as described for
CrossOriginConfig
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
CorsSupportBase.Builder<Q,
R, T extends CorsSupportBase<Q, R, T, B>, B extends CorsSupportBase.Builder<Q, R, T, B>> Builder forCorsSupportBase
instances. -
Constructor Summary
ModifierConstructorDescriptionprotected
CorsSupportBase
(CorsSupportBase.Builder<Q, R, T, B> builder) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
describe()
protected CorsSupportHelper
<Q, R> helper()
protected String
name()
protected void
prepareResponse
(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter) Not for developer user. Gets a response ready to participate in the CORS protocol.processRequest
(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter) Not for developer use. Submits a request adapter and response adapter for CORS processing.
-
Constructor Details
-
CorsSupportBase
-
-
Method Details
-
processRequest
protected Optional<R> processRequest(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter) Not for developer use. Submits a request adapter and response adapter for CORS processing.- Parameters:
requestAdapter
- wrapper around the requestresponseAdapter
- wrapper around the response- Returns:
- Optional of the response type U; present if the response should be returned, empty if request processing should continue
-
prepareResponse
protected void prepareResponse(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter) Not for developer user. Gets a response ready to participate in the CORS protocol.- Parameters:
requestAdapter
- wrapper around the requestresponseAdapter
- wrapper around the reseponse
-
helper
-
describe
-
name
-