Hello! I am working with some custom front-end application where we are connecting it to other services. As part of that, there is a necessity to send out web requests. I need to get confirmation on something involving server architecture and how the server handles requests. That being asynchronously/multi-threaded or on a single thread.
Because web requests are blocking and I can’t really think of a way to properly return data to the client using some sort of Future, I need to ensure that if a client sends a request to the server it won’t freeze and such.
Here’s how it works.
Client: Send request to OpenAPI at <application base>/json/WebHandler/someWebFunction
WebHandler is a simple shell meta class with some functions.
someWebFunction calls a java function in WebHandler.java which makes a web request.
Once the web request is finished, the data is returned in a stringified JSON format. (I would prefer to use a Java class, but there’s no documentation on wrapping Java classes with meta classes and then instantiating said meta class using the Java class.)
The client then interprets this response and does whatever is necessary.
What I want to know is the web request going to block the server or would that request be handled on a separate thread or in another non-blocking way.
Thank you!