dev.mccue.jdk.httpserver.regexrouter.RouteParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdk-httpserver-regexrouter Show documentation
Show all versions of jdk-httpserver-regexrouter Show documentation
Request router and dispatcher for the JDK's built-in HTTP server
The newest version!
package dev.mccue.jdk.httpserver.regexrouter;
import com.sun.net.httpserver.HttpExchange;
import java.util.Optional;
/**
* Parameters extracted from a {@link com.sun.net.httpserver.Request}
*/
public sealed interface RouteParams permits RegexRouter.MatcherRouteParams {
/**
* Retrieves a positional parameter.
* @param pos The position of the parameter.
* @return The parameter, if there is one.
*/
Optional param(int pos);
/**
* Retrieves a named parameter.
* @param name The name of the parameter.
* @return The parameter, if there is one.
*/
Optional param(String name);
static RouteParams get(HttpExchange exchange) {
return (RouteParams) exchange.getAttribute("dev.mccue.jdk.httpserver.regexrouter/route-params");
}
default void set(HttpExchange exchange) {
exchange.setAttribute("dev.mccue.jdk.httpserver.regexrouter/route-params", this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy