Package org.restheart.plugins
Interface Service<R extends ServiceRequest<?>,S extends ServiceResponse<?>>
- Type Parameters:
R- Request the request typeS- Response the response type
- All Superinterfaces:
ConfigurablePlugin,CORSHeaders,ExchangeTypeResolver<R,,S> HandlingPlugin<R,,S> Plugin
- All Known Subinterfaces:
BsonService,ByteArrayService,JsonService,StringService
public interface Service<R extends ServiceRequest<?>,S extends ServiceResponse<?>>
extends HandlingPlugin<R,S>, ConfigurablePlugin, CORSHeaders
Services allow to extend the API adding web services
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Field Summary
Fields inherited from interface org.restheart.exchange.CORSHeaders
ACCESS_CONTROL_ALLOW_CREDENTIAL, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS, DEFAULT_ACCESS_CONTROL_ALLOW_CREDENTIALS, DEFAULT_ACCESS_CONTROL_ALLOW_HEADERS, DEFAULT_ACCESS_CONTROL_ALLOW_METHODS, DEFAULT_ACCESS_CONTROL_ALLOW_ORIGIN, DEFAULT_ACCESS_CONTROL_EXPOSE_HEADERS -
Method Summary
Modifier and TypeMethodDescriptiondefault BiConsumer<R, S> handle()BiConsumer that handles the request Allows to provide the handlig logic with functional styledefault voidhandles the request the handling logic can also be provided overriding handle()default BiConsumer<R, S> helper BiConsumer to handle OPTIONS requestsdefault voidhandleOptions(R request) helper method to handle OPTIONS requestsrequest()Consumer<io.undertow.server.HttpServerExchange> response()Consumer<io.undertow.server.HttpServerExchange> Methods inherited from interface org.restheart.plugins.ConfigurablePlugin
arg, argOrDefaultMethods inherited from interface org.restheart.exchange.CORSHeaders
accessControlAllowCredentials, accessControlAllowHeaders, accessControlAllowMethods, accessControlAllowOrigin, accessControlExposeHeadersMethods inherited from interface org.restheart.plugins.ExchangeTypeResolver
requestType, responseType
-
Method Details
-
handle
handles the request the handling logic can also be provided overriding handle()- Parameters:
request-response-- Throws:
Exception
-
handle
BiConsumer that handles the request Allows to provide the handlig logic with functional style- Returns:
- the BiConsumer that handles the request
- Throws:
Exception
-
requestInitializer
Consumer<io.undertow.server.HttpServerExchange> requestInitializer()- Returns:
- the Consumer used to instantiate the request object
-
responseInitializer
Consumer<io.undertow.server.HttpServerExchange> responseInitializer()- Returns:
- the Consumer used to instantiate the response object
-
request
- Returns:
- the Function used to retrieve the request object
-
response
- Returns:
- the Function used to retrieve the response object
-
handleOptions
helper method to handle OPTIONS requests- Parameters:
request-- Throws:
Exception
-
handleOptions
helper BiConsumer to handle OPTIONS requests- Parameters:
request-- Throws:
Exception
-