All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.datakernel.http.BlockingServlet Maven / Gradle / Ivy

package io.datakernel.http;

import io.datakernel.async.Callback;
import io.datakernel.async.Stage;

public abstract class BlockingServlet implements AsyncServlet {
	@Override
	public final void serve(HttpRequest request, Callback callback) {
		try {
			HttpResponse httpResponse = serveBlocking(request);
			callback.set(httpResponse);
		} catch (Exception e) {
			callback.setException(e);
		}
	}

	@Override
	public final Stage serve(HttpRequest request) {
		throw new UnsupportedOperationException();
	}

	abstract public HttpResponse serveBlocking(HttpRequest request) throws Exception;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy