You can set it dynamically on-the-fly using PAGE_SCOPE.
Experts,
Any suggestion here ?
/** * Sample external/prefix that sets data for head injection * * @param context RequestContext * @return null (does work and doesn't add anything to the component model) */ public Document setRandomHeadInjection(RequestContext context) { String[] sample = { "Africa", "Antarctica", "Asia", "Europe", "North America", "South America", "Oceania" }; Random rng = new Random(System.currentTimeMillis()); int sel = rng.nextInt(sample.length); String str = "<script type='text/javascript'>\r\n</script>\r\n"; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Executing Debugging.setRandomHeadInjection: "+str); LOGGER.debug("--- START: RequestContext ---"); LOGGER.debug(context.toString()); LOGGER.debug("--- END: RequestContext ---"); } context.getPageScopeData().put(RuntimePage.PAGESCOPE_HEAD_INJECTION, str); return null; } /** * Sample external/prefix that sets data for body injection top * * @param context RequestContext * @return null (does work and doesn't add anything to the component model) */ public Document setRandomBodyTopInjection(RequestContext context) { String[] sample = { "Troposphere", "Stratosphere", "Mesosphere", "Thermosphere", "Exosphere" }; Random rng = new Random(System.currentTimeMillis()); int sel = rng.nextInt(sample.length); String str = "Page top injection: Hello from " + sample[sel] + ""; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Executing Debugging.setRandomBodyTopInjection: "+str); LOGGER.debug("--- START: RequestContext ---"); LOGGER.debug(context.toString()); LOGGER.debug("--- END: RequestContext ---"); } context.getPageScopeData().put(RuntimePage.PAGESCOPE_BODY_INJECTION_TOP, str); return null; } /** * Sample external/prefix that sets data for body injection bottom * * @param context RequestContext * @return null (does work and doesn't add anything to the component model) */ public Document setRandomBodyBottomInjection(RequestContext context) { String[] sample = { "Crust", "Mantle", "Liquid Outer Core", "Solid Inner Core" }; Random rng = new Random(System.currentTimeMillis()); int sel = rng.nextInt(sample.length); String str = "Page bottom injection: Hello from " + sample[sel] + ""; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Executing Debugging.setRandomBodyBottomInjection: "+str); LOGGER.debug("--- START: RequestContext ---"); LOGGER.debug(context.toString()); LOGGER.debug("--- END: RequestContext ---"); } context.getPageScopeData().put(RuntimePage.PAGESCOPE_BODY_INJECTION_BOTTOM, str); return null; }
Under developer.spar there is OOTB component which does this, but getting below error when I try to install developer.spr "[archiveinstaller] Caused by: com.interwoven.cssdk.access.CSAuthorizationException: Unknown Hopi error(Permission denied)[archiveinstaller] at com.interwoven.cssdk.sci.exception.ExceptionHandler.handleExceptionSci(ExceptionHandler.java:188)[archiveinstaller] at com.interwoven.cssdk.sci.exception.ExceptionHandler.handleException(ExceptionHandler.java:104)[archiveinstaller] at com.interwoven.cssdk.sci.filesys.FileServiceBranchSciImpl.setBranchDescription(FileServiceBranchSciImpl.java:906)[archiveinstaller] at com.interwoven.cssdk.sci.filesys.FileServiceSciImpl.setBranchDescription(FileServiceSciImpl.java:4229)[archiveinstaller] at com.interwoven.cssdk.filesys.java.FileServiceAdapterImpl.setBranchDescription(FileServiceAdapterImpl.java:621)[archiveinstaller] at com.interwoven.cssdk.filesys.impl.CSBranchImpl.setDescription(CSBranchImpl.java:496)[archiveinstaller] at com.interwoven.livesite.iw.impl.CSBackingStoreService.createOrUpdateBranch(CSBackingStoreService.java:270)[archiveinstaller] ... 41 moreBUILD FAILEDE:\Interwoven\TeamSite\install\install_archive.xml:116: Error importing files: Error creating bean with name 'teamsite.BackingStoreService' defined in URL [file:E:/Interwoven/TeamSite/install/livesite/install_scripts/teamsite-resource-config.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Error while creating/updating branch: /iwadmin/main/livesite"Looks like permission issue. Trying to figure out issue with this also.[/left]