0

I have two grails applications are application1 and application2. application1 use HTTPBuilder to call the application2 that return one template(gsp page). How can i display gsp page(the response) in my application1.I got status code 200. after that what i will do to display the page?how to return that response?

static def users(String akey,String userName){
        try {
           def ret = null
           def http = new HTTPBuilder("http://192.168.1.7:8080/Play0.1/main/userGroup")
           http.request(Method.POST, ContentType.HTML) {
               uri.query = [ aKey:aKey, userName:userName]
               headers.'User-Agent' = 'Mozilla/5.0 Ubuntu/8.10 Firefox/3.0.4'
               response.success = { resp,html -> println resp.status


                 }
               response.failure = { resp -> println "Unexpected error: ${resp.status} : ${resp.statusLine.reasonPhrase}" }
           }
           return ret
       } catch (groovyx.net.http.HttpResponseException ex) {
           ex.printStackTrace()
           return null
       } catch (java.net.ConnectException ex) {
           ex.printStackTrace()
           return null
       }
   }

That users action returns one gsp page.

Anantha
  • 109
  • 1
  • 1
  • 7

1 Answers1

0

As said in Wikipedia :

HTTP/1.1 302 Found
Location: http://www.iana.org/domains/example/

You should follow the Location header to obtain the content.

You may check that your application2 redirect or not and consider to implement REST design in application2 to avoid redirect in web service.

Isammoc
  • 883
  • 5
  • 20