webrick-route_servlet 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4acab3896a5966e52a287750419797607524db9f
4
- data.tar.gz: 782551c377a6ad7b591b8b60a1e9d62649ff209f
3
+ metadata.gz: 397fa019560396894135b4744be9920b854e8214
4
+ data.tar.gz: a5103f261531146f365564acb6de35529515eb2d
5
5
  SHA512:
6
- metadata.gz: 0202005cc2f708ad284fe629bc0c24d692d81b324391781f121a04b6fc6262f7d214e4901dc0df1fc8dc9ebb76ed4df230a277fbb63e72ddb7f7a9538199b72a
7
- data.tar.gz: 0770f6cf8afef2a15377e714a55b0bff18b46cefcfcd58c82a604a5b63921e9ed3ed5c60791aa26fb559de360dd10b73a17fddd059e4413c6a503cd3fb4081fc
6
+ metadata.gz: ce1e23750eefeb89db43af8ac9b7130915bbf222f613740c4668fa2c22e49d8ef39a3607e1d37898abe11a7b0bfe9c9486c4a8e53659d718fa2da978224d8a70
7
+ data.tar.gz: e113ad6d9ba8e7d81371c04bb189a0e840b29e272be31e54715861ba812044cefe444ae5b6cb70d3c51f652ec1c0bc19fbc10da8b15a641d4cd9f1c18642dd06
data/README.md CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
  server = WEBrick::HTTPServer.new(:Port=>3000)
23
23
  server.mount("/", WEBrick::RouteServlet.servlet{|s|
24
24
  s.root IndexServlet
25
- s.match "/:page", PageServlet
25
+ s.match "/:controller(/:action(/:id))(.:format)", ActionServlet
26
26
  s.match "/*path", NotFoundServlet
27
27
  })
28
28
  server.start
@@ -12,10 +12,11 @@ class IndexServlet < WEBrick::HTTPServlet::AbstractServlet
12
12
  res.body = "<h2>IndexServlet</h2>"
13
13
  res.body += "<h4>XxxApiServlet:</h4>"
14
14
  res.body += "<a href='/api/people/@me/@frields'>/api/people/@me/@frields</a><br />"
15
- res.body += "<a href='/api/no/match/api'>/api/no/match/api</a><br />"
15
+ res.body += "<a href='/api/activities/@me/@frields/@app'>/api/activities/@me/@frields/@app</a><br />"
16
+ res.body += "<a href='/api/no-match-path-route'>/api/no-match-path-route</a><br />"
16
17
  res.body += "<br />"
17
18
  res.body += "<h4>NotFoundServlet:</h4>"
18
- res.body += "<a href='/no/match/path'>/no/match/path</a><br />"
19
+ res.body += "<a href='/no/match/path/route'>/no/match/path/route</a><br />"
19
20
  end
20
21
  end
21
22
 
@@ -28,13 +29,16 @@ class NotFoundServlet < WEBrick::HTTPServlet::AbstractServlet
28
29
  end
29
30
  end
30
31
 
31
- class PeopleApiServlet < WEBrick::HTTPServlet::AbstractServlet
32
+ class OpenSocialApiServlet < WEBrick::HTTPServlet::AbstractServlet
32
33
  def do_GET(req, res)
33
34
  res.content_type = "text/plain"
34
35
  res.body = JSON.pretty_generate({
35
36
  "servlet" => self.class.name,
37
+ "type" => req.params["type"],
36
38
  "guid" => req.params["guid"],
37
39
  "selector" => req.params["selector"],
40
+ "appid" => req.params["appid"],
41
+ "resourceid" => req.params["resourceid"],
38
42
  })
39
43
  end
40
44
  end
@@ -55,7 +59,7 @@ server.mount("/", WEBrick::RouteServlet.servlet{|s|
55
59
  s.match "/*path", NotFoundServlet
56
60
  })
57
61
  server.mount("/api", WEBrick::RouteServlet.servlet{|s|
58
- s.match "/people/:guid/:selector", PeopleApiServlet
62
+ s.match "/:type/:guid/:selector(/:appid(/:resourceid))", OpenSocialApiServlet
59
63
  s.match "/*path", NotFoundApiServlet
60
64
  })
61
65
  server.start
@@ -48,7 +48,7 @@ end
48
48
  server = WEBrick::HTTPServer.new(:Port=>3000)
49
49
  server.mount("/", WEBrick::RouteServlet.servlet{|s|
50
50
  s.root IndexServlet
51
- s.match '/:controller(/:action(/:id))(.:format)', ActionServlet
51
+ s.match "/:controller(/:action(/:id))(.:format)", ActionServlet
52
52
  s.match "/*path", NotFoundServlet
53
53
  })
54
54
  server.start
@@ -1,13 +1,7 @@
1
1
  module WEBrick
2
2
  module RouteServlet
3
3
  module HTTPRequest
4
- def params
5
- @params
6
- end
7
-
8
- def params=(params)
9
- @params = params
10
- end
4
+ attr_accessor :params
11
5
  end
12
6
  end
13
7
  end
@@ -1,5 +1,5 @@
1
1
  module WEBrick
2
2
  module RouteServlet
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webrick-route_servlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshida Tetsuya