clojurewerkz.urly.core/encode-path
now handles colons in URI path.
clojurewerkz.urly.core/encode-path
encodes argument as URI path.
See What Every Developer Should Know About URL Encoding for more information.
Urly now depends on org.clojure/clojure
version 1.4.0
. It is still
compatible with Clojure 1.3 and if your project.clj
depends on 1.3,
it will be used, but 1.4 is the default now.
We encourage all users to upgrade to 1.4, it is a drop-in replacement for the majority of projects out there.
Added nil bubbling for PartsAccessors, which allows client to decide what to do with nil. That's especially useful when Url is invalid, therefore urly is not able to parse it.
clojurewerkz.urly.core/count-segments
can be used to calculate number of segments in the path:
(count-segments "http://apple.com") ;; => 0
(count-segments "http://apple.com/") ;; => 0
(count-segments"/") ;; => 0
(count-segments "http://apple.com/iphone") ;; => 1
(count-segments "/iphone") ;; => 1
(count-segments "http://apple.com/iphone/") ;; => 1
(count-segments "/iphone/") ;; => 1
(count-segments "http://store.apple.com/us/browse/home/shop_mac/family/mac_pro") ;; => 6
(count-segments (url-like "http://store.apple.com/us/browse/home/shop_mac/family/macbook_pro")) ;; => 6
(count-segments (java.net.URI. "http://store.apple.com/us/browse/home/shop_mac/family/macbook_pro")) ;; => 6
(count-segments (java.net.URL. "http://store.apple.com/us/browse/home/shop_mac/family/macbook_pro")) ;; => 6
(count-segments (url-like "http://www.amazon.com/Clojure-Programming-ebook/dp/B007Q4T040/ref=tmm_kin_title_0?ie=UTF8&m=A2JEPUQV26074G&qid=1337080272&sr=8-1")) ;; => 4
UrlLike#withWww
does the opposite of UrlLike#withoutWww
clojurewerkz.urly.UrlLike
now has several additional methods:
UrlLike#withoutQuery
UrlLike#withoutFragment
clojurewerkz.urly.core/without-query-string
and clojurewerkz.urly.core/without-fragment
were added, similar in purpose with
clojurewerkz.urly.core/without-query-string-and-fragment
.
clojurewerkz.urly.core/absolutize
and clojurewerkz.urly.core/normalize-url
were extracted from Crawlista
Authority (section 3.2 in RFC 3986) is now recalculated when hostname, port or user info are mutated.
clojurewerkz.urly.UrlLike#withoutWww
is a Java API addition that eliminates www.
, www.2
, www.11
and similar
prefixes from the hostname.
Reflection warnings for clojurewerkz.urly.core/resolve
were eliminated.
Urly test suite now has about 3K more new test cases for the parser.
clojurewerkz.urly.core/resolve
now supports UrlLike instances
New functions allow for query string mutation via function (much like Clojure atoms) and URL-encoding (note that Clojure API uses UTF-8 encoding):
clojurewerkz.urly.core/mutate-query-with
clojurewerkz.urly.core/encode-query
clojurewerkz.urly.core/encode-fragment
clojurewerkz.urly.UrlLike
now has several additional methods:
UrlLike#hasQuery
UrlLike#hasFragment
UrlLike#hasNonDefaultPort
UrlLike#encodeQuery
Extra protocol elimination (for example http://https://github.com
=> https://github.com
) is now
case-insensitive (will recognize http
as well as HTTp
).
clojurewerkz.urly.core/url-like
now uses fully-qualified class name for its return type hint.
This is a usability improvement: this way namespaces that use it won't have to import it.
UrlLike/homepageOf used to use default port value of 80. Starting with 1.0.0-beta9, it uses the same default prot as java.net.URI (-1).
urly.core/url-like
now recognizes cases like "google.com" or "amazon.co.uk" (Internet domain names) and
uses the input to assign UrlLike instance host (java.net.URI assigns path), which is what you typically
want.
In cases where you want classic behavior, use UrlLike/from
with a URI instance:
(UrlLike/from (java.net.URI. "amazon.de"))
urly.core/url-like
how handles cases when URL parts (typically query string) have unescaped spaces in them
urly.core/protocol-of
how correctly returns nil for inputs that have no protocol
urly.core/absolute?
and urly.core/relative?
now work for urly.UrlLike
instances
Added urly.core/eliminate-extra-protocol-prefixes
that turns URLs like http://https://example.com
into https://example.com
Urly now correctly uses JDK 6 as Java compilation target.
Urly now uses Leiningen 2.
Can you improve this documentation? These fine people already did:
Michael S. Klishin, Michael Klishin & Oleksandr PetrovEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close