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

io.github.stylesmile.app.MyHttpHandler Maven / Gradle / Ivy

//package io.github.stylesmile.app;
//
//import io.github.stylesmile.handle.HandlerManager;
//import io.github.stylesmile.handle.MappingHandler;
//import com.sun.net.httpserver.HttpExchange;
//import com.sun.net.httpserver.HttpHandler;
//
//import java.io.IOException;
//import java.lang.reflect.InvocationTargetException;
//import java.util.List;
//
///**
// * @author Stylesmile
// */
//public class MyHttpHandler implements HttpHandler {
//    @Override
//    public void handle(HttpExchange httpExchange) throws IOException {
//        String url = httpExchange.getRequestURI().toString();
//        System.out.println(url);
//        //获取所有Controller和内部定义的接口方法列表
//        List mappingHandlerList = HandlerManager.getMappingHandlerList();
//        //找到当前请求Url对应的Controller接口处理方法
//        for (MappingHandler mappingHandler : mappingHandlerList) {
//            try {
//                if (mappingHandler.handle(httpExchange)) {
//                    return;
//                }
//            } catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
//                e.printStackTrace();
//            }
//        }
//    }
//}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy