Jersey Rest Api for 6.2 version

I am trying to set up a grails application with Jesey RESTBuilder plugin

RequestBuilder rest = new RequestBuilder()
def resp = rest.post(“http://localhost:8181/bonita/loginservice?username=TestUser&password=bpm&redirect=false&redirectUrl=”)
println("resp ******* " + resp)

// resp prints nothing here.

and then when I do below.

resp = rest.get {
uri = “http://localhost:8181/bonita/API/identity/user/303/
}

I get Status 401 received. HttpUnauthorizedException.
I believe, login did not work.

Any thoughts?