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: 3.0.0-rc1
Show newest version
package swagger;

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.Context ctx) {
        try {
            //TODO: Do stuff you want to handle with each API call (metrics, logging, etc..)
            return delegate.call(ctx);
        } 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