ann
          冰是沒有未來的,因為它的永恒
          posts - 107,comments - 34,trackbacks - 0
          public class RestaurantCenterJettyStarter {
              
          public static void main(String[] args) {
                  
          long start = System.currentTimeMillis();
                  
          try {
                      
          // set up files and urls
          //            URL[] urls;
          //            {
          //                urls = RefreshingURLClassLoader.getReloadableUrls();
          //            }

                      
          // deal with classloader
          //            ClassLoader parent = Thread.currentThread().getContextClassLoader();
                      
          //
                      
          // eclipse will recompile the class. so I disable this
                      
          //
                      
          // for (int i = 0; i < files.length; i++) {
                      
          // File file = files[i];
                      
          // CompilingClassLoader ccl = new CompilingClassLoader(parent,
                      
          // file);
                      
          // ccl.start();
                      
          // parent = ccl;
                      
          // }
          //            URLClassLoader urlCloader = new RefreshingURLClassLoader(urls, parent);
          //            Thread.currentThread().setContextClassLoader(urlCloader);

                      
          // finally, start the server!
                      Server server = new Server();
                      SelectChannelConnector connector 
          = new SelectChannelConnector();
                      connector.setPort(
          8080);
                      connector.setReuseAddress(
          false); //這樣就不能重復啟動同一個 jetty 了. jetty starter 不檢查 端口是否被占用
                      server.setConnectors(
          new Connector[] { connector });

                      
          // WebAppContext wac4 = new WebAppContext("./chatty", "/chatty");
                      
          // WebAppContext wac = new WebAppContext("/s100-webdata/photo",
                      
          // "/photo");
                      
          // WebAppContext wac2 = new WebAppContext("/s100-webdata/photo",
                      
          // "/video");
                      WebAppContext wac3 = new WebAppContext("./web""/RestaurantCenter");

                      
          // wac.setClassLoader(urlCloader);
                      
          // wac2.setClassLoader(urlCloader);
          //            wac3.setClassLoader(urlCloader);
                      
          // wac4.setClassLoader(urlCloader);

                      ContextHandlerCollection contexts 
          = new ContextHandlerCollection();
                      contexts.setHandlers(
          new Handler[] { wac3, /* wac, wac2,wac4 */}); // the
                      
          // order
                      
          // doesn't
                      
          // matter

                      HandlerCollection handlers 
          = new HandlerCollection();
                      handlers.setHandlers(
          new Handler[] { contexts, new DefaultHandler() });

                      server.setHandler(handlers);
                      server.start();
                      
          long duration = System.currentTimeMillis() - start;
                      System.out.println(
          "啟動 Jetty 服務器 in " + duration + "ms");
                      System.out.println(
          "Web Service is @ http://localhost:8080/RestaurantCenter/RestaurantWebService?wsdl" );
                  } 
          catch (Exception e) {
                      e.printStackTrace();
                  }

              }
          }

          posted on 2009-06-12 15:15 冰是沒有未來的,因為它的永恒 閱讀(443) 評論(0)  編輯  收藏 所屬分類: javatool

          當下,把心放下 放下如果是可能的,那一定是在當下,
          不在過去,也不在未來。
          當下放下。唯有活在當下,你的問題才能放下。

          主站蜘蛛池模板: 沂水县| 工布江达县| 宕昌县| 凤庆县| 双桥区| 德清县| 宁夏| 朝阳区| 治多县| 太湖县| 辉县市| 张掖市| 庆安县| 阜阳市| 谷城县| 会理县| 鄂伦春自治旗| 沅江市| 枝江市| 三明市| 翁牛特旗| 容城县| 宝兴县| 灵川县| 新泰市| 满城县| 桑日县| 安徽省| 鄂温| 沙洋县| 赤峰市| 璧山县| 菏泽市| 曲松县| 锡林郭勒盟| 城口县| 盐边县| 潞西市| 皋兰县| 平和县| 上林县|