82

GitHub - EricEdens/urllib: A modern URL toolset for Java. Compliant with RFC 398...

 6 years ago
source link: https://github.com/EricEdens/urllib
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

urllib

Urllib is a library that makes URL manipulation easy, fun, and safe!

  • Zero extra dependencies.
  • Supports Java 7+, Android 14+.
  • Compliant with RFC 3986.
  • Immutable and threadsafe.
  System.out.println(
      Url.http("maps.google.com")
         .path("maps")
         .query("q", "Búðardalur")
         .create());

  >> http://maps.google.com/maps?q=B%C3%BA%C3%B0ardalur

  System.out.println(
      Url.parse("https://www.wolframalpha.com/input/?i=%E2%88%9A-1")
         .query()
         .params());

  >> {i=√-1}

We're in preview!

Feel free to check out the code and give feedback! The first stable release will be 1.0. In the meantime, builds are available on jitpack:

Gradle

   repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
   }

   dependencies {
         compile 'org.urllib:urllib:master-SNAPSHOT'
   }

Maven

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.urllib</groupId>
            <artifactId>urllib</artifactId>
            <version>master-SNAPSHOT</version>
        </dependency>
    </dependencies>
  • 0.1
    • Create a Url from scratch with builders.
    • Interop with java.net.URI
    • Support ASCII DNS hosts.
  • 0.2
    • Expose component fields (scheme, host, path, etc..) via methods on the Url object.
  • 0.3
    • Support IPv4 hosts.
  • 0.4
    • Support IPv6 hosts.
  • 0.5
    • Support IDN hosts.
  • 0.6
    • Create a Url by parsing.
  • 0.7
    • Utility method to create a java.net.URI from a previously-encoded URL.
  • 0.8
    • Resolve a possibly-relative link against an existing Url
  • 0.9
    • Utility method to classify a potential URL. Is it junk? A protocol-relative URL? An absolute path?
  • 1.0
    • Encode a Url to display to users (like in a web browser URL bar)

License

Apache 2.0


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK