ÔĶÁÉÏÒ»¸öÖ÷Ìâ :: ÔĶÁÏÂÒ»¸öÖ÷Ìâ |
×÷Õß |
ÕýÎÄ |
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:22
|
|
|
Ç°ÑÔ£¬ÍøÂç/webʱ´ú£¬¸÷ÖÖweb¿ò¼Ü²ã³ö²»Ç×î½ü¿´µ½ÓÐÈËÌáµ½ Vert.x Õâôһ¸ö¿ò¼Ü£¬¾Ý˵ÅÜÔÚJava VMÉÏ£¬Ö§³Ö¶àÖÖÓïÑÔµÄApplication¹²´æ£¬È»ºó¾Í¿´µ½¶ÔÓÚÒ»¸ö¼òµ¥Web ServerµÄʵÏÖ£¬¸÷¸öÓïÑԵİ汾¡£
²»¿´²»ÖªµÀ£¬Ò»¿´²ÅÖªµÀ×Ô¼ºÓжàOutÁË£¬¾ÓÈ»Óм¸¸öÓïÑÔ¸ù±¾Ã»Ìý˵¹ý¡£
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
|
|
Â¥Ö÷ |
µçÌÝÖ±´ï
|
|
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:23
|
|
|
ʵÏÖÒ»£º
´úÂë: |
load('vertx.js')
vertx.createHttpServer().requestHandler(function(req) {
var file = req.path === '/' ? 'index.html' : req.path;
req.response.sendFile('webroot/' + file);
}).listen(8080)
|
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
|
|
ɳ·¢ |
·µ»Ø¶¥¶Ë
|
|
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:23
|
|
|
ʵÏÖ¶þ£º
´úÂë: |
import org.vertx.java.core.Handler;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.deploy.Verticle;
public class Server extends Verticle {
public void start() {
vertx.createHttpServer().requestHandler(req -> {
String file = req.path.equals("/") ? "index.html" : req.path;
req.response.sendFile("webroot/" + file);
}).listen(8080);
}
}
|
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
°åµÊ |
·µ»Ø¶¥¶Ë
|
|
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:24
|
|
|
Implementation 3:
´úÂë: |
require "vertx"
Vertx::HttpServer.new.request_handler do |req|
file = req.uri == "/" ? "index.html" : req.uri
req.response.send_file "webroot/#{file}"
end.listen(8080)
|
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
µØ°å |
·µ»Ø¶¥¶Ë
|
|
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:24
|
|
|
Implementation 4:
´úÂë: |
vertx.createHttpServer().requestHandler { req ->
def file = req.uri == "/" ? "index.html" : req.uri
req.response.sendFile "webroot/$file"
}.listen(8080)
|
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
5 ¥ |
·µ»Ø¶¥¶Ë
|
|
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:25
|
|
|
Implementation 5:
´úÂë: |
import vertx
server = vertx.create_http_server()
@server.request_handler
def handle(req):
filename = "index.html" if req.uri == "/" else req.uri
req.response.send_file("webroot/" + filename)
server.listen(8080)
|
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
6 ¥ |
·µ»Ø¶¥¶Ë
|
|
webdriver (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 10:25
|
|
|
Implementation 6:
´úÂë: |
(ns example.server
(:require [vertx.http :as http]))
(-> (http/server)
(http/on-request
(fn [req]
(let [uri (.uri req)]
(-> req
(http/server-response)
(http/send-file (str "webroot/" (if (= "/" uri) "index.html" uri)))))))
(http/listen 8080))
|
_________________ There is no wisdom tree; nor a stand of a mirror bright, Since all is void, where can the dust alight?
|
|
|
7 ¥ |
·µ»Ø¶¥¶Ë
|
|
±¾ÄDZȾÂÔ (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 12:09
|
|
|
ÔÚÍâÈË¿´À´£¬ÕâÖ»²»¹ýÊÇÌïÀïг¤³öÀ´µÄÒ»ÖÖ×÷Î²»¹ÜÈçºÎºÃ¿´£¬ÖÕ¾¿ÊǸöÊ߲ˡ£¡£¡£:lol:
|
|
|
8 ¥ |
·µ»Ø¶¥¶Ë
|
|
ÃûÕðÒ»·½ (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 12:12
|
|
|
ż³ò×ųýÁ˸ö±ðÁ½¸öÈ«ÊÇjava¡£¡£ ÔÎ
_________________ |Pxz-Pzy| ¡Ü 1 + Pxy
Why is 6 so sad?
|
|
|
9 ¥ |
·µ»Ø¶¥¶Ë
|
|
nessus (Ö»¿´´ËÈË)
|
ʱ¼ä: 2015-3-02 12:59
|
|
|
3,5,6¶¼²»ÖªµÀÊÇɶ
|
|
|
10 ¥ |
·µ»Ø¶¥¶Ë
|
|
|