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

io.github.azagniotov.stubby4j.handlers.AbstractHandlerExtension Maven / Gradle / Ivy

Go to download

A highly flexible & configurable tool for testing interactions of SOA applications with web services (REST, SOAP, WSDL etc.) over HTTP(S) protocol. It is an actual HTTP server (stubby4j uses embedded Jetty) that acts like a real web service, ready for consumption by your code. Allows stubbing of external systems with ease for integration testing

There is a newer version: 7.6.1
Show newest version
package io.github.azagniotov.stubby4j.handlers;

import io.github.azagniotov.stubby4j.utils.ConsoleUtils;
import org.eclipse.jetty.server.Request;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface AbstractHandlerExtension {

    default boolean logAndCheckIsHandled(final String handlerName,
                                         final Request baseRequest,
                                         final HttpServletRequest request,
                                         final HttpServletResponse response) {
        ConsoleUtils.logIncomingRequest(request);
        if (baseRequest.isHandled() || response.isCommitted()) {
            ConsoleUtils.logIncomingRequestError(request, handlerName, "HTTP response was committed or base request was handled, aborting..");
            return true;
        }

        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy