Documention for: url-handler.r Created by: hallyhaa on: 30-May-2007 Last updated by: hallyhaa on: 30-Jan-2009 Format: text/editable Downloaded on: 30-Apr-2025 Easy to use! *Construct your object like this:* site: url-handler "http://www.rebol.com" print site/url ; == http://www.rebol.com/ *Then go somewhere else with it:* site/move-to "docs.html" site/move-to "http://www.rebol.com/docs/core23/rebolcore-1.html" site/move-to "#sect1" *What is now registered about your URL is this:* print site/protocol ; == "http://" print site/host ; == "www.rebol.com" print site/path ; == "/docs/core23/" print site/file ; == "rebolcore-1.html" print site/query-part ; == "" print site/section ; == "#sect1" print site/canonical ; == "http://www.rebol.com:80/docs/core23/rebolcore-1.html#sect1" print site/as-string/from-path-only ; == "/docs/core23/rebolcore-1.html" *Then what about CGI GET queries? Here:* site: url-handler "http://dummy.com/index.html?zz=b&hj=d&e=5&f=a%20b&sid=5¬hing=&re=bol#s3" *Get the query as a string:* probe site/query-part ; == "?zz=b&hj=d&e=5&f=a%20b&sid=5¬hing=&re=bol" *Or access it as a block:* probe site/query-block ; == [e: "5" f: "a b" hj: "d" nothing: none re: "bol" sid: "5" zz: "b"] ~Note that the query part is sorted when in a block.~ *Here's almost the same URL, but note the difference in the query-part (paramters in a different order):* site2: url-handler "http://dummy.com/index.html?hj=d&e=5&f=a%20b&sid=5¬hing=&re=bol&zz=b#s3" *If you tell the script to pay attention to the order in which the parameters first came in, the two URLs are not identical:* print site2/equal?/regard-cgi-order/regard-section site ; == false *But if you disregard the cgi order, they are identical:* print site2/equal?/regard-section site ; == true *The same goes for the /regard-section refinement. If you do not specify it, the section part of URLs will not be compared.*