About Me

My photo
Author of Groovy modules: GBench, GProf, Co-author of a Java book パーフェクトJava, Game Developer at GREE

Saturday, February 5, 2011

Groovy URLConnectionBuilder 0.0.2 is out

I released URLConnectionBuilder 0.0.2. If you are new to URLConnectionBuilder, please see my previous post first. The following are the changes.


1. Package name change
New pakcage name is net.sourceforge.urlconnbuilder.


2. Better support for proxy
----
URLConnectionBuilder connBuilder = new URLConnectionBuilder()
connBuilder.url('http://groovy.codehaus.org/') {
    connect(proxy: 'http://proxyhost:proxyport') {
        configure(
            // configure URLConnection
        ) 
        communicate(
            input: { conn, stream ->
                println stream.text
            }
        )
    }
}
----


URL version:
----
proxy: new URL('http://proxyhost:proxyport')
----


URI version:
----
proxy: URI.create('socks5://proxyhost:proxyport')
----


3. Support for authentication
----
URLConnectionBuilder connBuilder = new URLConnectionBuilder()
connBuilder.url('http://groovy.codehaus.org/') {
    connect(authentication: 'username:password') {
        configure(
            // configure URLConnection
        ) 
        communicate(
            input: { conn, stream ->
                println stream.text
            }
        )
    }
}
----


List version:
----
authentication: [ 'username', 'password' ]
----


Map version:
----
authentication: [ username: 'username', password: 'password' ]
----


   

No comments:

Post a Comment