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

JavaPlayFramework.apiCall.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
package openapitools;

import com.google.inject.Inject;
import play.mvc.Action;
import play.mvc.Http;
import play.mvc.Result;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

public class ApiCall extends Action {

    @Inject
    private ApiCall() {}

    public CompletionStage call(Http.Request request) {
        try {
            //TODO: Do stuff you want to handle with each API call (metrics, logging, etc..)
            return delegate.call(request);
        } catch (Throwable t) {
            //TODO: log the error in your metric

            //We rethrow this error so it will be caught in the ErrorHandler
            throw t;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy