handlers.groovy 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. // Licensed Materials - Property of IBM
  2. // BI and PM: Mobile
  3. // (C) Copyright IBM Corp. 2007, 2020
  4. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. package processors
  6. import com.cognos.mobile.c8.C8PortalTreeQueryMachineFactory;
  7. import com.cognos.mobile.c8.C8PortalTreeQueryMachineFactoryImpl;
  8. import com.cognos.mobile.c8.IC8Configuration;
  9. import com.cognos.mobile.common.CMErrors;
  10. import com.cognos.mobile.common.CMException;
  11. import com.cognos.mobile.common.CMStringHelper;
  12. import com.cognos.mobile.common.CMUrlConstants;
  13. import com.cognos.mobile.common.IInputStreamFactory;
  14. import com.cognos.mobile.common.IPersistenceStore;
  15. import com.cognos.mobile.database.IMobileDatabase;
  16. import com.cognos.mobile.location.ConfigParser;
  17. import com.cognos.mobile.location.IReverseGeocoder;
  18. import com.cognos.mobile.server.core.SCConfiguration;
  19. import com.cognos.mobile.server.core.SCRequest;
  20. import com.cognos.mobile.server.core.SCResponse;
  21. import com.cognos.mobile.server.core.SCUserSession;
  22. import com.cognos.mobile.server.handler.AboutHandler;
  23. import com.cognos.mobile.server.handler.RenderStatusHandler;
  24. import com.cognos.mobile.server.handler.RenderInProgressHandler;
  25. import com.cognos.mobile.server.handler.RenderInProgressLegacyHandler;
  26. import com.cognos.mobile.server.handler.RenderHandler;
  27. import com.cognos.mobile.server.handler.BrowsePortalHandler;
  28. import com.cognos.mobile.server.handler.BrowseTreePromptHandler;
  29. import com.cognos.mobile.server.handler.CCSHandler;
  30. import com.cognos.mobile.server.handler.ChangeTabHandler;
  31. import com.cognos.mobile.server.handler.ChunkedRequestHandler;
  32. import com.cognos.mobile.server.handler.ContentHandler;
  33. import com.cognos.mobile.server.handler.DashboardHandler;
  34. import com.cognos.mobile.server.handler.DeleteRenderHandler;
  35. import com.cognos.mobile.server.handler.DownloadDBHandler;
  36. import com.cognos.mobile.server.handler.DownloadZoomHandler;
  37. import com.cognos.mobile.server.handler.DrillThroughHandler;
  38. import com.cognos.mobile.server.handler.DrillThrough3Handler;
  39. import com.cognos.mobile.server.handler.RunNextPageHandler;
  40. import com.cognos.mobile.server.handler.DrillUpDownHandler;
  41. import com.cognos.mobile.server.handler.FavouriteHandler;
  42. import com.cognos.mobile.server.handler.GetKeyHandler;
  43. import com.cognos.mobile.server.handler.GetSettingsHandler;
  44. import com.cognos.mobile.server.handler.HistoryHandler;
  45. import com.cognos.mobile.server.handler.IHandler;
  46. import com.cognos.mobile.server.handler.IPromptFiller;
  47. import com.cognos.mobile.server.handler.MRVHandler;
  48. import com.cognos.mobile.server.handler.NotificationHandler;
  49. import com.cognos.mobile.server.handler.ReportHandler;
  50. import com.cognos.mobile.server.handler.ReverseGeocodeHandler;
  51. import com.cognos.mobile.server.handler.RunReportHandler;
  52. import com.cognos.mobile.server.handler.SavedOutputHandler;
  53. import com.cognos.mobile.server.handler.SearchHandler;
  54. import com.cognos.mobile.server.handler.StatusHandler;
  55. import com.cognos.mobile.server.handler.UserHandler;
  56. import com.cognos.mobile.server.handler.ResourceHandler;
  57. import com.cognos.mobile.server.handler.ViewRenderHandler;
  58. import com.cognos.mobile.server.handler.MobileJSInterfaceHandler;
  59. import com.cognos.mobile.server.handler.ImageThumbnailHandler;
  60. import com.cognos.mobile.server.handler.SkinsHandler;
  61. import com.cognos.mobile.server.location.ReverseGeocodingPromptFiller;
  62. import com.cognos.mobile.standardedition.DOM4JUtil;
  63. import com.cognos.mobile.standardedition.InputStreamFactory;
  64. import com.cognos.mobile.standardedition.StringUtil;
  65. import com.cognos.mobile.vm.VM;
  66. def CLASS = getClass();
  67. VM.log(CLASS, VM.SEVERITY_DEBUG, "reading location configuration");
  68. IReverseGeocoder reverseGeocoder = ConfigParser.parse(mobileService.getC8Configuration().getConfigurationDirectory() + "/mobile", "location.xml");
  69. if (reverseGeocoder != null) {
  70. controller.setLocationPromptFiller(new ReverseGeocodingPromptFiller(reverseGeocoder));
  71. controller.registerHandler(CMUrlConstants.SERVLET_GEO, new ReverseGeocodeHandler(reverseGeocoder));
  72. VM.log(CLASS, VM.SEVERITY_DEBUG, "configured reverse-geocoding prompt-filler");
  73. } else {
  74. controller.setLocationPromptFiller(null);
  75. VM.log(CLASS, VM.SEVERITY_DEBUG, "no reverse-geocoder specified in location.xml; no prompt-filler configured");
  76. }
  77. C8PortalTreeQueryMachineFactory portalTreeQueryMachineFactory =
  78. new C8PortalTreeQueryMachineFactoryImpl();
  79. controller.registerHandler(CMUrlConstants.SERVLET_ABOUT, new AboutHandler());
  80. controller.registerHandler(CMUrlConstants.SERVLET_RENDER_STATUS, new RenderStatusHandler(mobileService.getDatabase()));
  81. controller.registerHandler(CMUrlConstants.SERVLET_RENDER_IN_PROGRESS, new RenderInProgressLegacyHandler());
  82. controller.registerHandler(CMUrlConstants.SERVLET_BROWSE_PORTAL, new BrowsePortalHandler());
  83. controller.registerHandler(CMUrlConstants.SERVLET_BROWSE_TREE_PROMPT, new BrowseTreePromptHandler(mobileService.getC8Configuration(), mobileService.getInputStreamFactory()));
  84. controller.registerHandler(CMUrlConstants.SERVLET_COMPILE_REPORT, new RunReportHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool(), controller.getLocationPromptFiller(), portalTreeQueryMachineFactory));
  85. controller.registerHandler(CMUrlConstants.SERVLET_DELETE_RENDER, new DeleteRenderHandler(mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore()));
  86. controller.registerHandler(CMUrlConstants.SERVLET_DOWNLOAD_DB, new DownloadDBHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore()));
  87. controller.registerHandler(CMUrlConstants.SERVLET_DOWNLOAD_ZOOM, new DownloadZoomHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore()));
  88. controller.registerHandler(CMUrlConstants.SERVLET_GET_SETTINGS, new GetSettingsHandler(mobileService.getSCConfiguration()));
  89. controller.registerHandler(CMUrlConstants.SERVLET_SEARCH, new SearchHandler(mobileService.getSCConfiguration(), mobileService.getC8Configuration()));
  90. controller.registerHandler(CMUrlConstants.SERVLET_CCS, new CCSHandler(mobileService.getC8Configuration(), mobileService.getInputStreamFactory()));
  91. controller.registerHandler(CMUrlConstants.SERVLET_CHUNKREQUEST, new ChunkedRequestHandler(mobileService.getDatabase()));
  92. controller.registerHandler(CMUrlConstants.SERVLET_STATUS, new StatusHandler());
  93. controller.registerHandler(CMUrlConstants.SERVLET_DRILLTHROUGH, new DrillThroughHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool()));
  94. controller.registerHandler(CMUrlConstants.SERVLET_DRILL_UP_DOWN, new DrillUpDownHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool()));
  95. controller.registerHandler(CMUrlConstants.SERVLET_GET_KEY, new GetKeyHandler(mobileService.getSCConfiguration(), mobileService.getDatabase()));
  96. controller.registerHandler(CMUrlConstants.SERVLET_VIEW_RENDER, new ViewRenderHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool(), controller.getLocationPromptFiller()));
  97. controller.registerHandler(CMUrlConstants.SERVLET_DASHBOARD, new DashboardHandler(mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore()));
  98. controller.registerHandler(CMUrlConstants.SERVLET_FAVOURITE, new FavouriteHandler(mobileService.getDatabase()));
  99. // IMPORTANT NOTE!
  100. // Ordering of registration of handlers is significant
  101. // you will want to put the least likely match first. Example, /user/inbox/2 before /user/inbox
  102. // otherwise the wrong handler may try to intercept the call
  103. UserHandler uh = new UserHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(),mobileService.getTmpStore());
  104. def formats = "($CMUrlConstants.FORMAT_HTML)|($CMUrlConstants.FORMAT_JSON)|($CMUrlConstants.FORMAT_XML)"
  105. def formatsFull = "($CMUrlConstants.FORMAT_HTML)|($CMUrlConstants.FORMAT_HTM)|($CMUrlConstants.FORMAT_JSON)|($CMUrlConstants.FORMAT_XML)|($CMUrlConstants.IMAGEFORMAT_JPEG)|($CMUrlConstants.IMAGEFORMAT_JPG)|($CMUrlConstants.IMAGEFORMAT_PNG)|($CMUrlConstants.IMAGEFORMAT_SVG)|($CMUrlConstants.IMAGEFORMAT_GIF)|($CMUrlConstants.FORMAT_JS)|($CMUrlConstants.FORMAT_CSS)|($CMUrlConstants.FORMAT_DTD)|($CMUrlConstants.FORMAT_ICO)|($CMUrlConstants.FORMAT_PDF)|($CMUrlConstants.FORMAT_CSV)|($CMUrlConstants.FORMAT_XLS)|($CMUrlConstants.FORMAT_XLSX)|($CMUrlConstants.FORMAT_XSD)|($CMUrlConstants.FORMAT_MHT)|($CMUrlConstants.FORMAT_DSSTORE)|($CMUrlConstants.FORMAT_ZIP)|($CMUrlConstants.FORMAT_HTML_TILDE)|($CMUrlConstants.FORMAT_HTM_TILDE)|($CMUrlConstants.FORMAT_JS_TILDE)|($CMUrlConstants.FORMAT_CSS_TILDE)|($CMUrlConstants.FORMAT_DPK)|($CMUrlConstants.FORMAT_CUR)|($CMUrlConstants.FORMAT_TXT)"
  106. controller.registerHandler( "$controller.MOBILESERVICE/user/home/(\\d+)\\.?($formats)?", ["renderId", "format"], uh);
  107. controller.registerHandler( "$controller.MOBILESERVICE/user/home\\.?($formats)?", ["format"], uh);
  108. controller.registerHandler( "$controller.MOBILESERVICE/user/home2/(\\d+)\\.?($formats)?", ["renderId", "format"], uh);
  109. controller.registerHandler( "$controller.MOBILESERVICE/user/home2\\.?($formats)?", ["format"], uh);
  110. controller.registerHandler( "$controller.MOBILESERVICE/user/namespace\\.?($formats)?", ["format"], uh);
  111. controller.registerHandler( "$controller.MOBILESERVICE/user/inbox/(\\d+)\\.?($formats)?", ["renderId", "format"], uh);
  112. controller.registerHandler( "$controller.MOBILESERVICE/user/inbox/(cm:|source:)(.*)", ["type", "id"], uh);
  113. controller.registerHandler( "$controller.MOBILESERVICE/user/inbox\\.?($formats)?", ["format"], uh);
  114. controller.registerHandler( "$controller.MOBILESERVICE/user/dashboard/(\\d+)\\.?($formats)?", ["renderId", "format"], uh);
  115. controller.registerHandler( "$controller.MOBILESERVICE/user/fav/(.*?)\\.?($formats)?", ["storeId", "format"], uh);
  116. controller.registerHandler( "$controller.MOBILESERVICE/user/key/(.*?)/(.*?)\\.?($formats)?", ["userId","platform", "format"], uh);
  117. controller.registerHandler( "$controller.MOBILESERVICE/user/key/(.*?)\\.?($formats)?", ["platform", "format"], uh);
  118. controller.registerHandler("$controller.MOBILESERVICE/user/logoff", [], uh);
  119. ImageThumbnailHandler imageUploadHandler = new ImageThumbnailHandler(mobileService.getDatabase());
  120. controller.registerHandler( "$controller.MOBILESERVICE/thumbUpload\\.?($formats)", ["format"], imageUploadHandler);
  121. RenderHandler renderHandler = new RenderHandler(mobileService.getSCConfiguration(),
  122. mobileService.getC8Configuration(),
  123. isf,
  124. tmp,
  125. database);
  126. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/pages/(\\d+)/thumb\\.?(($CMUrlConstants.IMAGEFORMAT_PNG))?", ["renderId", "page", "format"], renderHandler);
  127. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/pages/(\\d+)/dashboard\\.?(($CMUrlConstants.IMAGEFORMAT_PNG))?", ["renderId", "page", "format"], renderHandler);
  128. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/pages/(\\d+)\\.?(($CMUrlConstants.FORMAT_HTML))?", ["renderId", "page", "format"], renderHandler);
  129. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/pages/(.*?)?", ["renderId", "format"], renderHandler);
  130. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/report/content/pages//(\\d+)/thumb\\.?(($CMUrlConstants.IMAGEFORMAT_PNG))?", ["renderId", "page", "format"], renderHandler);
  131. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/report/content/pages//(\\d+)/dashboard\\.?(($CMUrlConstants.IMAGEFORMAT_PNG))?", ["renderId", "page", "format"], renderHandler);
  132. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/report/content/pages/(\\d+)\\.?(($CMUrlConstants.FORMAT_HTML))?", ["renderId", "page", "format"], renderHandler);
  133. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/report/content/pages/(.*?)?", ["renderId", "format"], renderHandler);
  134. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/report/content/(.*?)?", ["renderId", "format"], renderHandler);
  135. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/images/(\\d+)\\.?(($CMUrlConstants.IMAGEFORMAT_JPEG)|($CMUrlConstants.IMAGEFORMAT_PNG)|($CMUrlConstants.IMAGEFORMAT_SVG))?", ["renderId", "blobId", "format"], renderHandler);
  136. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/charts/(\\d+)\\.?(($CMUrlConstants.IMAGEFORMAT_JPEG)|($CMUrlConstants.IMAGEFORMAT_PNG)|($CMUrlConstants.IMAGEFORMAT_SVG)|($CMUrlConstants.IMAGEFORMAT_HTML))?", ["renderId", "blobId", "format"], renderHandler);
  137. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/tables/(\\d+)\\.?(($CMUrlConstants.FORMAT_HTML)|($CMUrlConstants.IMAGEFORMAT_PNG))?", ["renderId", "blobId", "format"], renderHandler);
  138. controller.registerHandler( "$controller.MOBILESERVICE/renders/(\\d+)/session/.*\\.?($CMUrlConstants.FORMAT_JSON)", ["renderId","format"], renderHandler);
  139. RenderInProgressHandler renderInProgressHandler = new RenderInProgressHandler(database, tmp, mobileService.getC8Configuration());
  140. controller.registerHandler( "${controller.MOBILESERVICE}.absolute/renderinprogress/cancel/(\\d+)\\.?($formats)?", [CMUrlConstants.PARAM_RENDERID[0], "format"], renderInProgressHandler);
  141. controller.registerHandler( "${controller.MOBILESERVICE}.absolute/renderinprogress/(\\d+)\\.?($formats)?", [CMUrlConstants.PARAM_RENDERID[0], "format"], renderInProgressHandler);
  142. // render in progress check really should be absolute affinity. The following path mapping is registered
  143. // because mobile can be installed on top of older BI installs where the caf rules do not allow mobileService.absolute.
  144. // in that case the first mob to receive the request adds .absolute to the soapaction and asks dispatcher to redispatch it.
  145. // CAF doesn't check dispatcher to dispatcher requests.
  146. controller.registerHandler( "${controller.MOBILESERVICE}/(.*)/renderinprogress/cancel/(\\d+)\\.?($formats)?", [CMUrlConstants.PARAM_P64GUID[0], CMUrlConstants.PARAM_RENDERID[0] ,"format"], renderInProgressHandler);
  147. controller.registerHandler( "${controller.MOBILESERVICE}/(.*)/renderinprogress/(\\d+)\\.?($formats)?", [CMUrlConstants.PARAM_P64GUID[0], CMUrlConstants.PARAM_RENDERID[0], "format"], renderInProgressHandler);
  148. ResourceHandler rsh = new ResourceHandler(mobileService.getDatabase(), mobileService.getAdminNotifier());
  149. controller.registerHandler( "$controller.MOBILESERVICE/resources/(.*?)/(.*?)\\.?($formatsFull)?", [CMUrlConstants.PARAM_RENDERID[0],"hash","format"], rsh);
  150. controller.registerHandler( "$controller.MOBILESERVICE/resources/(.*?)\\.?($formatsFull)?", ["hash","format"], rsh);
  151. //controller.registerHandler( "$controller.MOBILESERVICE/user/history/page/(\\d+)\\.?($formats)?", ["page", "format"], "processors/history.groovy");
  152. SavedOutputHandler soh = new SavedOutputHandler(mobileService.getDatabase(),mobileService.getInputStreamFactory(),mobileService.getSCConfiguration(), mobileService.getC8Configuration(), mobileService.getTmpStore(),mobileService.getThreadPool());
  153. controller.registerHandler( "$controller.MOBILESERVICE/report/(.*?)/output/(.*?)\\.?($formats)?", ["rStoreId", "soStoreId", CMUrlConstants.PARAM_FORMAT[0]], soh);
  154. controller.registerHandler( "$controller.MOBILESERVICE/report/dt3\\.($formats)", ["format"], new DrillThrough3Handler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool()));
  155. controller.registerHandler( "$controller.MOBILESERVICE/report/nextPage\\.($formats)", ["format"], new RunNextPageHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool()));
  156. controller.registerHandler( "$controller.MOBILESERVICE/report/changeTab\\.($formats)", ["format"], new ChangeTabHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool()));
  157. ReportHandler rh = new ReportHandler(controller, scconfig, database, isf, c8config, tmp, threadpool, gte);
  158. controller.registerHandler( "$controller.MOBILESERVICE/report/drillthrough/\\.($formats)?", [CMUrlConstants.PARAM_FORMAT[0]], rh);
  159. controller.registerHandler( "$controller.MOBILESERVICE/report/ccs/(.*?)/(.*?)\\.?($formats)?", [CMUrlConstants.PARAM_STORE_ID[0], CMUrlConstants.PARAM_CCS_PATH[0], CMUrlConstants.PARAM_FORMAT[0]], rh);
  160. controller.registerHandler( "$controller.MOBILESERVICE/report/details/(.*?)\\.?($formats)?", [CMUrlConstants.PARAM_STORE_ID[0], CMUrlConstants.PARAM_FORMAT[0]], rh);
  161. controller.registerHandler( "$controller.MOBILESERVICE/report/ios/(.*?)/prompt:(.*?)\\.?($formats)?", [CMUrlConstants.PARAM_STORE_ID[0], CMUrlConstants.PARAM_PROMPT_ID[0], CMUrlConstants.PARAM_FORMAT[0]], rh);
  162. controller.registerHandler( "$controller.MOBILESERVICE/report/(.*?)\\.?($formats)?", [CMUrlConstants.PARAM_STORE_ID[0], CMUrlConstants.PARAM_FORMAT[0]], rh);
  163. //controller.registerHandler( "$controller.MOBILESERVICE/history\\.?($formats)?", ["format"], "processors/history.groovy");
  164. controller.registerHandler( "$controller.MOBILESERVICE/cm/(.*?)\\.?($formats)?", ["cmpath", "format"], "processors/cm.groovy");
  165. controller.registerHandler( "$controller.MOBILESERVICE/about\\.?($formats)?", ["format"], "processors/about.groovy");
  166. controller.registerHandler( "$controller.MOBILESERVICE/output/(\\d+)/page/(\\d+)\\.?($formats)?", [CMUrlConstants.PARAM_RENDERID[0], CMUrlConstants.PARAM_PAGE_INDEX[0], CMUrlConstants.PARAM_RENDER_OUTPUT_FORMAT[0]], new ViewRenderHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore(), mobileService.getThreadPool(), controller.getLocationPromptFiller()));
  167. ContentHandler ch = new ContentHandler(mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration());
  168. controller.registerHandler("$controller.MOBILESERVICE/content\\.?(xml|json)?", [CMUrlConstants.PARAM_FORMAT[0]], ch);
  169. // controller.registerHandler("$controller.MOBILESERVICE/content/([/a-zA-Z0-9]*)\\.?(xml|json)?", [CMUrlConstants.PARAM_ATOM_LINK[0],CMUrlConstants.PARAM_FORMAT[0]], "processors/content.groovy");
  170. controller.registerHandler("$controller.MOBILESERVICE/content/(.+?)\\.?(xml|json)?", ["sourcepath", "format"], ch);
  171. def imageFormats = "(($CMUrlConstants.IMAGEFORMAT_PNG)|($CMUrlConstants.IMAGEFORMAT_JPEG)|($CMUrlConstants.IMAGEFORMAT_HTML))"
  172. DownloadZoomHandler dzh = new DownloadZoomHandler(mobileService.getSCConfiguration(), mobileService.getDatabase(), mobileService.getInputStreamFactory(), mobileService.getC8Configuration(), mobileService.getTmpStore());
  173. controller.registerHandler("$controller.MOBILESERVICE/zoom/output/(\\d+)\\.?($imageFormats)?", [CMUrlConstants.PARAM_RENDERID[0], "format"], dzh);
  174. controller.registerHandler("$controller.MOBILESERVICE/zoom/output/(\\d+)/width/(\\d+)\\.?($imageFormats)?", [ CMUrlConstants.PARAM_RENDERID[0], "width", "format" ], dzh);
  175. controller.registerHandler("$controller.MOBILESERVICE/zoom/output/(\\d+)/height/(\\d+)\\.?($imageFormats)?", [ CMUrlConstants.PARAM_RENDERID[0], "height" ], dzh);
  176. HistoryHandler hh = new HistoryHandler(mobileService.getDatabase());
  177. controller.registerHandler("$controller.MOBILESERVICE/history/(short|full)/(first|rest)?\\.?(xml|json)?", [CMUrlConstants.PARAM_HISTORY_LIST_TYPE[0], CMUrlConstants.PARAM_HISTORY_START[0],CMUrlConstants.PARAM_FORMAT[0]], hh);
  178. controller.registerHandler("$controller.MOBILESERVICE/history/(en|cs|da|de|es|fi|fr|hr|hu|it|ja|ko|nl|pl|pt|ro|ru|sk|sv|th|tr|zh-cn|zh-tw)/(short|full)/(first|rest)?\\.?(xml|json)?", [CMUrlConstants.PARAM_HISTORY_LANG[0],CMUrlConstants.PARAM_HISTORY_LIST_TYPE[0], CMUrlConstants.PARAM_HISTORY_START[0],CMUrlConstants.PARAM_FORMAT[0]], hh);
  179. MRVHandler mrvh = new MRVHandler(mobileService.getDatabase());
  180. controller.registerHandler("$controller.MOBILESERVICE/mrv\\.?(xml|json)?", [CMUrlConstants.PARAM_FORMAT[0]], mrvh);
  181. SearchHandler sh = new SearchHandler(mobileService.getSCConfiguration(),mobileService.getC8Configuration());
  182. controller.registerHandler("$controller.MOBILESERVICE/search\\.?(xml|json)", [CMUrlConstants.PARAM_FORMAT[0]], sh);
  183. controller.registerHandler( "$controller.MOBILESERVICE/resources2\\.?($formatsFull)?", ["format"], "processors/resource2.groovy");
  184. MobileJSInterfaceHandler mjs = new MobileJSInterfaceHandler(mobileService.getC8Configuration());
  185. controller.registerHandler("$controller.MOBILESERVICE/mobile_interface\\.js", [], mjs);
  186. def formats2 = "($CMUrlConstants.FORMAT_HTML)|($CMUrlConstants.FORMAT_JSON)|($CMUrlConstants.FORMAT_XML | $CMUrlConstants.FORMAT_TXT)"
  187. SkinsHandler suh = new SkinsHandler(mobileService.getSCConfiguration(),
  188. mobileService.getDatabase());
  189. controller.registerHandler("$controller.MOBILESERVICE/skins/upload\\.?($formats)", ["format"], suh);
  190. controller.registerHandler("$controller.MOBILESERVICE/skins/browse\\.?($formats)", ["format"], suh);
  191. controller.registerHandler("$controller.MOBILESERVICE/skins/delete\\.?($formats2)", [CMUrlConstants.PARAM_RENDERID[1], "format"], suh);
  192. NotificationHandler nh = new NotificationHandler(mobileService.getAdminNotifier());
  193. controller.registerHandler( "$controller.MOBILESERVICE/notify\\.?($formats)?", ["format"], nh);