Prev | Current Page 249 | Next

David Berube

"Practical Reporting with Ruby and Rails"


CHAPTER 9 n INVESTMENT TRACKING WITH FIDELITY 179
Next, you create a new Mongrel::HttpServer instance on a hard-coded interface and
port number. Note that, by default, it serves files on only your loopback interface, so once
you??™re finished testing it and you??™re happy that it won??™t leak any details of your portfolio,
you need to change the interface variable to 0.0.0.0.
After that, you register your handler class. Note the string, which indicates the path
for which each handler will receive requests. The handlers receive everything starting
with the indicated path, unless there??™s a more specific handler; in other words, the following
URLs will all be handled by StocksHandler:
http://127.0.0.1/
http://127.0.0.1/random_path
http://127.0.0.1/test
These handlers ignore path information, so if they receive a request, they treat it
in the same way, no matter what the exact path is. If you want to ignore nonstandard
requests, you can parse the URLs and throw errors in your Mongrel handler.
nNote If you??™re communicating complex information in your URLs, you may be better off using a more
powerful framework??”such as Merb, Sinatra, or Ruby on Rails??”rather than parsing the URLs yourself.


Pages:
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
zakłady bukmacherskie Kalkulator kredytowy Wczasy nad morzem uchwyt lcd zrębki