Module io.helidon.webserver.cors
Package io.helidon.webserver.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.webserver.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 forCrossOriginConfig
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CorsSupportBase.Builder<Q,R,T extends CorsSupportBase<Q,R,T,B>,B extends CorsSupportBase.Builder<Q,R,T,B>>
Builder forCorsSupportBase
instances.protected static interface
CorsSupportBase.RequestAdapter<T>
Not for use by developers. Minimal abstraction of an HTTP request.protected static interface
CorsSupportBase.ResponseAdapter<T>
Not for use by developers. Minimal abstraction of an HTTP response.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CorsSupportBase(CorsSupportBase.Builder<Q,R,T,B> builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
describe()
protected io.helidon.webserver.cors.CorsSupportHelper<Q,R>
helper()
protected String
name()
protected void
prepareResponse(CorsSupportBase.RequestAdapter<Q> requestAdapter, CorsSupportBase.ResponseAdapter<R> responseAdapter)
Not for developer user. Gets a response ready to participate in the CORS protocol.protected Optional<R>
processRequest(CorsSupportBase.RequestAdapter<Q> requestAdapter, CorsSupportBase.ResponseAdapter<R> responseAdapter)
Not for developer use. Submits a request adapter and response adapter for CORS processing.
-
-
-
Constructor Detail
-
CorsSupportBase
protected CorsSupportBase(CorsSupportBase.Builder<Q,R,T,B> builder)
-
-
Method Detail
-
processRequest
protected Optional<R> processRequest(CorsSupportBase.RequestAdapter<Q> requestAdapter, CorsSupportBase.ResponseAdapter<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(CorsSupportBase.RequestAdapter<Q> requestAdapter, CorsSupportBase.ResponseAdapter<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
-
describe
protected String describe()
-
name
protected String name()
-
-