I am just starting out with Armeria and struggling to fully understand some things.
I implemented DecoratingHttpServiceFunction
in order to supply requests to a service with a Hibernate session.
@Override
public HttpResponse serve(HttpService delegate, ServiceRequestContext ctx, HttpRequest req) {
... // setup session for the request context
HttpResponse response = delegate.serve(ctx, req);
... // close session
return response;
}
But apparently the session gets closed before the service actually gets called and the request returned from delegate.serve
is an instance of DeferredHttpResponse
. Is my approach just completely wrong or is there a better way to do what I want to do?