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

io.muserver.RouteHandler Maven / Gradle / Ivy

The newest version!
package io.muserver;

import java.util.Map;

/**
 * A handler for a Route created with {@link MuServerBuilder#addHandler(Method, String, RouteHandler)}
 * or {@link Routes#route(Method, String, RouteHandler)}
 */
public interface RouteHandler {

    /**
     * Called when a request matches the given route
     * @param request The request
     * @param response The response
     * @param pathParams A map of path parameters, for example id would equal "123"
     *                   if the route URI template was /things/{id : [0-9]+} and the requested URI was
     *                   /things/123
     * @throws Exception Throwing an exception will result in a 500 error code being returned.
     */
    void handle(MuRequest request, MuResponse response, Map pathParams) throws Exception;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy