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

com.github.squirrelgrip.scientist4k.ExperimentHandler.kt Maven / Gradle / Ivy

There is a newer version: 0.6.6
Show newest version
package com.github.squirrelgrip.scientist4k

import com.github.squirrelgrip.scientist4k.configuration.HttpExperimentConfiguration
import org.eclipse.jetty.server.Request
import org.eclipse.jetty.server.handler.AbstractHandler
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse


class ExperimentHandler(
        val experiment: HttpExperiment
) : AbstractHandler() {

    constructor(httpExperimentConfiguration: HttpExperimentConfiguration): this(HttpExperimentBuilder(httpExperimentConfiguration).build())

    override fun handle(
            target: String,
            baseRequest: Request,
            request: HttpServletRequest,
            response: HttpServletResponse
    ) {
        experiment.run(request, response)
        baseRequest.isHandled = true
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy