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

org.javawebstack.httpserver.router.DefaultRouteAutoInjector Maven / Gradle / Ivy

Go to download

This library provides a routing and request mapping stack on top of the well known and industry proven eclipse jetty http server. It also supports websockets.

There is a newer version: 1.0.2
Show newest version
package org.javawebstack.httpserver.router;

import org.javawebstack.httpserver.Exchange;
import org.javawebstack.httpserver.helper.HttpMethod;
import org.javawebstack.httpserver.websocket.WebSocket;

import java.util.Map;

public class DefaultRouteAutoInjector implements RouteAutoInjector {
    public static final DefaultRouteAutoInjector INSTANCE = new DefaultRouteAutoInjector();

    public Object getValue(Exchange exchange, Map extraArgs, Class type) {
        if (Exchange.class.isAssignableFrom(type))
            return exchange;
        if (WebSocket.class.isAssignableFrom(type) && extraArgs.containsKey("websocket"))
            return extraArgs.get("websocket");
        if (type.equals(HttpMethod.class))
            return exchange.getMethod();
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy