« March 2009 | Main | May 2009 »

9 posts from April 2009

04/25/2009

Groovy 1.6.2 Released

Today, Groovy 1.6.2 was released. 1.6.2 is a maintenance release that fixes a few items—check the Jira changelog for more information. You can download groovy binaries or source at the main groovy download site.

04/23/2009

Groovy Script: Use HTTP Builder to Check Web Server Type

With the help of some folks on the groovy-user mailing list, I wrote the following script to pull the server name header from an HTTP HEAD request. Mostly, I use this for verification purposes when setting ServerTokens to Prod on an apache server or when suppressing the tomcat server identity. The script uses Tom Nichols' HTTP Builder module for groovy. Running it is pretty straightforward as the script only takes one argument; enter the URL of the site you want to test. For example:

./checkServerType.groovy http://blogs.techstacks.com/

#!/usr/bin/env groovy

import groovyx.net.http.HTTPBuilder
import static groovyx.net.http.Method.HEAD
import static groovyx.net.http.ContentType.TEXT

// create a new builder
def http = new HTTPBuilder( args[0] )

http.request( HEAD, TEXT ) {req ->
response.success = { resp ->
println " ${resp.getFirstHeader('Server')} "
}
response.failure = { resp ->
println "Server Response: ${resp.statusLine}"
}
}

04/18/2009

Groovy XMLRPC: Practice Scripts

I've been playing with Groovy lately and using it to play with some web services. They will only work if you have the groovy xmlrpc library in your $GROOVY_LIB. The following scripts are basic ping scripts for blog directories Technorati, IceRocket, and Blo.gs. Plug in your blog's title and blog's URL and ping away!

Groovy - Technorati Ping

#!/usr/bin/env groovy

import groovy.net.xmlrpc.*

def server = new XMLRPCServerProxy("http://rpc.technorati.com/rpc/ping")

def result = server.weblogUpdates.ping("BLOG TITLE" , "BLOG URL")

if (result != null)
println "Thanks for the ping!"

 

Groovy - IceRocket Ping

#!/usr/bin/env groovy

import groovy.net.xmlrpc.*

def server = new XMLRPCServerProxy("http://rpc.icerocket.com:10080/")

def result = server.ping("BLOG TITLE" , "BLOG URL")

if (result != null)
println "Thanks for the ping!"

 

Groovy - weblogs.com Ping

#!/usr/bin/env groovy

import groovy.net.xmlrpc.*

def server = new XMLRPCServerProxy("http://ping.blo.gs/")

def result = server.weblogUpdates.extendedPing("BLOG TITLE" , "BLOG URL" , "FEED URL")

if (result != null)
println "Thanks for the ping!"