src/de/htwsaar/simpleHTTP/lib/Router.java
@Override
    public void handle(HttpExchange t) throws IOException {
        Request req = new Request(t);
        Response res = new Response(t);

        try {
            Method method = this.routeTable.get(req.getMethod() + ":" + req.getPath());

            // Try to pass execution to the correct handler function
            method.invoke(null, req, res);

        } catch (InvocationTargetException | IllegalAccessException ie) {
            Router.handleInternalServerError(req, res);
        } catch (NullPointerException ne) {
            Router.handleNotFound(req, res);
        }

        System.out.println(java.time.LocalTime.now() + " [" + req.getPath() + "] " + req.getMethod() + " " + res.getStatusCode());
    }
/**
     * Routes incoming requests according to the internal Routing table
     *
     * @param t HttpExchange
     * @throws IOException
     */
Routes incoming requests according to the internal Routing table
@param t HttpExchange
@throws IOException
Routes incoming requests according to the internal Routing table @param t HttpExchange @throws IOException
@Override
    public void handle(HttpExchange t) throws IOException {
        Request req = new Request(t);
        Response res = new Response(t);
        try {
            Method method = this.routeTable.get(req.getMethod() + ":" + req.getPath());
            method.invoke(null, req, res);
        } catch (InvocationTargetException | IllegalAccessException ie) {
            Router.handleInternalServerError(req, res);
        } catch (NullPointerException ne) {
            Router.handleNotFound(req, res);
        }
        System.out.println(java.time.LocalTime.now() + " [" + req.getPath() + "] " + req.getMethod() + " " + res.getStatusCode());
    }
@ Override public void handle ( HttpExchange t ) throws IOException { Request req = new Request ( t ) ; Response res = new Response ( t ) ; try { Method method = this . routeTable . get ( req . getMethod ( ) + ":" + req . getPath ( ) ) ; method . invoke ( null , req , res ) ; } catch ( InvocationTargetException | IllegalAccessException ie ) { Router . handleInternalServerError ( req , res ) ; } catch ( NullPointerException ne ) { Router . handleNotFound ( req , res ) ; } System . out . println ( java . time . LocalTime . now ( ) + " [" + req . getPath ( ) + "] " + req . getMethod ( ) + " " + res . getStatusCode ( ) ) ; }
Routes incoming requests according to the internal Routing table
 @param t HttpExchange
 @throws IOException
Routes incoming requests according to the internal Routing table @param t HttpExchange @throws IOException
// Try to pass execution to the correct handler function