From c878ff5d06f1d363073839c83130d82c30610ab7 Mon Sep 17 00:00:00 2001 From: Markos Calderon Date: Fri, 21 Sep 2012 16:03:53 -0500 Subject: [PATCH] added redirect and clientURL parameters to the API --- .../web/controllers/ApiController.groovy | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index c5ce773658..65bc44355a 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -327,8 +327,41 @@ class ApiController { session.setMaxInactiveInterval(SESSION_TIMEOUT); - log.info("Successfully joined. Redirecting to ${paramsProcessorUtil.getDefaultClientUrl()}"); - redirect(url: paramsProcessorUtil.getDefaultClientUrl()) + //check if exists the param redirect + boolean redirectClient = true; + String clientURL = paramsProcessorUtil.getDefaultClientUrl(); + + if(!StringUtils.isEmpty(params.redirect)) + { + try{ + redirectClient = Boolean.parseBoolean(params.redirect); + }catch(Exception e){ + redirectClient = true; + } + } + if(!StringUtils.isEmpty(params.clientURL)){ + clientURL = params.clientURL; + } + + if(redirectClient){ + log.info("Successfully joined. Redirecting to ${paramsProcessorUtil.getDefaultClientUrl()}"); + redirect(url: clientURL); + } + else{ + log.info("Successfully joined. Sending XML response."); + response.addHeader("Cache-Control", "no-cache") + withFormat { + xml { + render(contentType:"text/xml") { + response() { + returncode(RESP_CODE_SUCCESS) + messageKey("successfullyJoined") + message("You have joined successfully.") + } + } + } + } + } } /*******************************************