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

org.zalando.riptide.DispatchPlugin Maven / Gradle / Ivy

The newest version!
package org.zalando.riptide;

import lombok.AllArgsConstructor;

import static org.zalando.fauxpas.FauxPas.throwingFunction;

@AllArgsConstructor
final class DispatchPlugin implements Plugin {

    private final MessageReader reader;

    @Override
    public RequestExecution aroundDispatch(final RequestExecution execution) {
        return arguments -> execution.execute(arguments)
                .thenApply(throwingFunction(response -> {
                    try {
                        arguments.getRoute().execute(response, reader);
                    } catch (final NoWildcardException e) {
                        throw new UnexpectedResponseException(response);
                    }

                    return response;
                }));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy