Package futureweb

Source Code of futureweb.FutureWeb

package futureweb;

import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import webserver.netty.HttpSnoopServer;

import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
* Created by dns on 5/6/2014.
*/
public class FutureWeb {
  public String host;
  public int port;
  public HashMap<String, Route> routes;
  //public HttpRequest request;
  public String content;

  public FutureWeb () {
    routes = new HashMap<>();
    host = "0.0.0.0";
    port = 8080;
  }
  public void setHost(String _host) {
    host = _host;
    port = 8080;
  }
  public void setPort (int _port) {
    host = "0.0.0.0";
    port = _port;
  }


  public void run () throws Exception {
    new HttpSnoopServer(this);
    //routes.get("/").callback();
  }


  public void get (Route route) {
    //r.handle("test 777");
    routes.put(route.path, route);

  }



  public boolean route_matcher (String uri) {

    if (routes.containsKey(uri)) return true;   // match route
    else return false;                           // match static file

  }




}
TOP

Related Classes of futureweb.FutureWeb

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.