From 6186f6cb1f3ab4105426c27cfe2e83e282d64105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claes=20Wallin=20=28=E9=9F=8B=E5=98=89=E8=AA=A0=29?= Date: Thu, 11 Jul 2013 12:17:41 +0800 Subject: [PATCH] req.response() -> req.response in Rhino manual --- core_manual_js.html | 8 ++++---- docs_md/core_manual_js.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core_manual_js.html b/core_manual_js.html index ec4241e..adbe6c2 100644 --- a/core_manual_js.html +++ b/core_manual_js.html @@ -1725,11 +1725,11 @@

Specifying matches.


var routeMatcher = new vertx.RouteMatcher(); routeMatcher.get('/animals/dogs', function(req) { - req.response().end('You requested dogs'); + req.response.end('You requested dogs'); }); routeMatcher.get('/animals/cats', function(req) { - req.response().end('You requested cats'); + req.response.end('You requested cats'); }); server.requestHandler(routeMatcher).listen(8080, 'localhost'); @@ -1748,7 +1748,7 @@

Extracting parameters from the path routeMatcher.put('/:blogname/:post', function(req) { var blogName = req.params().get('blogname'); var post = req.params().get('post'); - req.response().end('blogname is ' + blogName + ', post is ' + post); + req.response.end('blogname is ' + blogName + ', post is ' + post); }); server.requestHandler(routeMatcher).listen(8080, 'localhost'); @@ -1779,7 +1779,7 @@

Extracting params using Reg

Handling requests where nothing matches


You can use the noMatch method to specify a handler that will be called if nothing matches. If you don't specify a no match handler and nothing matches, a 404 will be returned.

routeMatcher.noMatch(function(req) {
-    req.response().end('Nothing matched');
+    req.response.end('Nothing matched');
 });
 

WebSockets


diff --git a/docs_md/core_manual_js.md b/docs_md/core_manual_js.md index 5f87a3f..9dabb6b 100644 --- a/docs_md/core_manual_js.md +++ b/docs_md/core_manual_js.md @@ -1982,11 +1982,11 @@ You can then add different matches to the route matcher. For example, to send al var routeMatcher = new vertx.RouteMatcher(); routeMatcher.get('/animals/dogs', function(req) { - req.response().end('You requested dogs'); + req.response.end('You requested dogs'); }); routeMatcher.get('/animals/cats', function(req) { - req.response().end('You requested cats'); + req.response.end('You requested cats'); }); server.requestHandler(routeMatcher).listen(8080, 'localhost'); @@ -2012,7 +2012,7 @@ If you want to extract parameters from the path, you can do this too, by using t routeMatcher.put('/:blogname/:post', function(req) { var blogName = req.params().get('blogname'); var post = req.params().get('post'); - req.response().end('blogname is ' + blogName + ', post is ' + post); + req.response.end('blogname is ' + blogName + ', post is ' + post); }); server.requestHandler(routeMatcher).listen(8080, 'localhost'); @@ -2056,7 +2056,7 @@ It will display 'first is animals and second is cats'. You can use the `noMatch` method to specify a handler that will be called if nothing matches. If you don't specify a no match handler and nothing matches, a 404 will be returned. routeMatcher.noMatch(function(req) { - req.response().end('Nothing matched'); + req.response.end('Nothing matched'); }); # WebSockets