set(attribute=${calpath}, value="calPath=public/cals/MainCal") set(attribute=${genericFeederArgs}, value="/feeder/main/listEvents.do?${calPath}&setappvar=summaryMode(details)") set(attribute=${bwGeneralFeedPrefix}, value="${genericFeederArgs}&skinName=") path-template('/v1.0/categories/{skin}/{objName}') -> redirect('/feeder/widget/categories.do?${calpath}&skinName=${skin}&setappvar=objName(${objName})') path-template('/v1.0/groups/{skin}/{objName}') -> redirect('/feeder/widget/group.do?${calpath}&skinName=${skin}&setappvar=objName(${objName})') path-template('/v1.0/jsonDays/{days}/{skin}/{filter}/{objName}') -> { equals(${filter}, "no--filter") -> { redirect('${bwGeneralFeedPrefix}${skin}&days=${days)&setappvar=objName("${objName}")') } else { redirect('${bwGeneralFeedPrefix}${skin}&days=${days)&setappvar=objName("${objName}")&fexpr=${filter}') } } ------------------------------------------------------------------------ Config from orig "/v1.0/rssDays/$days/$skin/$filter" (controller: "feederURL", action: "rssXmlDays") "/v1.0/xmlDays/$days/$skin/$filter" (controller: "feederURL", action: "rssXmlDays") def rssXmlDays = { String bwUrl = "$bwGeneralFeedPrefix" + params.skin + "&days=" + params.days + filterArg() println("rssXmlDays Action: Feeder URL is " + bwUrl) if (fetchContent(bwUrl)) { render(text: content, contentType:"text/html", encoding:"UTF-8") } else { return } } "/v1.0/icsDays/$days/$filter" (controller: "feederURL", action: "icsDays") String bwIcsFeedPrefix = bedeworkServer + genericFeederArgs + "&format=text/calendar" def icsDays = { String bwUrl = "$bwIcsFeedPrefix" + "&days=" + params.days + filterArg() println("rssDays Action: Feeder URL is " + bwUrl) if (fetchContent(bwUrl)) { render(text: content, contentType:"text/calendar", encoding:"UTF-8") } else { return } } "/v1.0/jsonRange/$startDate/$endDate/$skin/$filter/$objName" (controller: "feederURL", action: "jsonRange") def jsonRange = { String bwUrl = "$bwGeneralFeedPrefix" + params.skin + "&start=" + params.startDate + "&end=" + params.endDate + "&setappvar=objName(" + params.objName + ")" + filterArg() if (fetchContent(bwUrl)) { render(text: content, contentType:"text/html", encoding:"UTF-8") } else { return } } "/v1.0/rssRange/$startDate/$endDate/$skin/$filter" (controller: "feederURL", action: "rssXmlRange") "/v1.0/xmlRange/$startDate/$endDate/$skin/$filter" (controller: "feederURL", action: "rssXmlRange") def rssXmlRange = { String bwUrl = "$bwGeneralFeedPrefix" + params.skin + "&start=" + params.startDate + "&end=" + params.endDate + filterArg() println("rssXmlRange Action: Feeder URL is " + bwUrl) if (fetchContent(bwUrl)) { render(text: content, contentType:"text/html", encoding:"UTF-8") } else { return } } "/v1.0/icsRange/$startDate/$endDate/$filter" (controller: "feederURL", action: "icsRange") def icsRange = { String bwUrl = "$bwIcsFeedPrefix" + "&days=" + params.startDate + "&end=" + params.endDate + filterArg() println("icsRange Action: Feeder URL is " + bwUrl) if (fetchContent(bwUrl)) { render(text: content, contentType:"text/calendar", encoding:"UTF-8") } else { return } } "/$controller/$action?/$id?"{ constraints { // apply constraints here } } "/"(view:"/index") "500"(view:'/error') } } def index = { redirect(url:"$bedeworkServer") } def noConnection = { def errorMsg = "Can't reach $bedeworkServer/feeder. Is Bedework running?" render(text: errorMsg, contentType:"text/html", encoding:"UTF-8") } // def fetchContent (bwUrl) { try { def content = bwUrl.toURL().text return true } catch (error) { printf ("webcache: " + error) redirect(action:noConnection) } } def filterName () { if (params.filter) { List filterSplits = params.filter.tokenize('.') return filterSplits[0] } } def extensionName () { if (params.filter) { List filterSplits = params.filter.tokenize('.') return filterSplits[1] } } def filterArg () { if ( filterName() == "no--filter" ) { return "" } else { String encodedFilter = URLEncoder.encode(params.filter) return "&fexpr=$encodedFilter" } } }