Interface Service<R extends ServiceRequest<?>,S extends ServiceResponse<?>>

Type Parameters:
R - Request the request type
S - 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>
  • Method Details

    • handle

      default void handle(R request, S response) throws Exception
      handles the request the handling logic can also be provided overriding handle()
      Parameters:
      request -
      response -
      Throws:
      Exception
    • handle

      default BiConsumer<R,S> handle() throws Exception
      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

      Function<io.undertow.server.HttpServerExchange,R> request()
      Returns:
      the Function used to retrieve the request object
    • response

      Function<io.undertow.server.HttpServerExchange,S> response()
      Returns:
      the Function used to retrieve the response object
    • handleOptions

      default void handleOptions(R request)
      helper method to handle OPTIONS requests
      Parameters:
      request -
      Throws:
      Exception
    • handleOptions

      default BiConsumer<R,S> handleOptions()
      helper BiConsumer to handle OPTIONS requests
      Parameters:
      request -
      Throws:
      Exception