Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/main/java/com/dream11/rest/AbstractRestVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ public Completable rxStart() {
return this.startHttpServer().doOnSuccess(server -> this.httpServer = server).ignoreElement();
}

/**
* Starts the HTTP server with reactive backpressure management and request routing.
*
* <p>
* This method initializes the Resteasy deployment and router, creates an HTTP server using the
* configured options, and sets up a reactive request stream with backpressure handling. Requests are
* paused upon receipt; if backpressure forces a drop, the request is logged and replied to with a 503 status.
* Requests whose paths match the pattern "/swaagger(.*)" are routed through a dedicated router,
* while all other requests are processed by the Resteasy request handler.
* </p>
*
* @return a Single that emits the started HTTP server instance
*/
private Single<HttpServer> startHttpServer() {
VertxResteasyDeployment deployment = this.buildResteasyDeployment();
Router router = this.getRouter();
Expand Down Expand Up @@ -99,6 +112,15 @@ private Single<HttpServer> startHttpServer() {
.doOnSubscribe(disposable -> handleRequests.subscribe());
}

/**
* Creates and configures a Router for handling HTTP requests.
*
* <p>This method instantiates a new Router (without a Vert.x context) and registers default handlers:
* a BodyHandler for processing request bodies, a ResponseContentTypeHandler for setting response
* content types, and a StaticHandler for serving static files.</p>
*
* @return a Router instance preconfigured with standard handlers for RESTful operations
*/
protected Router getRouter() {
Router router = Router.router(null);
router.route().handler(BodyHandler.create());
Expand Down