コード例 #1
0
 /**
  * Carica e salva la configurazione di sistema del servizio.
  *
  * @throws ApsSystemException
  */
 protected void loadConfigs() throws ApsSystemException {
   try {
     ConfigInterface configManager = this.getConfigManager();
     String xml = configManager.getConfigItem(JpnewsletterSystemConstants.NEWSLETTER_CONFIG_ITEM);
     if (xml == null) {
       throw new ApsSystemException(
           "Configuration item not present: "
               + JpnewsletterSystemConstants.NEWSLETTER_CONFIG_ITEM);
     }
     NewsletterConfigDOM configDOM = new NewsletterConfigDOM();
     this.setConfig(configDOM.extractConfig(xml));
   } catch (Throwable t) {
     ApsSystemUtils.logThrowable(t, this, "loadConfigs");
     throw new ApsSystemException("Errore in fase di inizializzazione", t);
   }
 }
コード例 #2
0
 public int doEndTag() throws JspException {
   try {
     if (null == _root) {
       ConfigInterface configService =
           (ConfigInterface)
               ApsWebApplicationUtils.getBean(
                   SystemConstants.BASE_CONFIG_MANAGER, this.pageContext);
       _root = configService.getParam(SystemConstants.PAR_RESOURCES_ROOT_URL);
     }
     if (null == _folder) {
       _folder = "";
     }
     pageContext.getOut().print(_root + _folder);
   } catch (Throwable e) {
     ApsSystemUtils.logThrowable(e, this, "doEndTag");
     throw new JspException("Error closing the tag", e);
   }
   return EVAL_PAGE;
 }
コード例 #3
0
 public void testGetParam() throws ApsSystemException {
   ConfigInterface baseConfigManager =
       (ConfigInterface) this.getService(SystemConstants.BASE_CONFIG_MANAGER);
   String param = baseConfigManager.getParam(SystemConstants.CONFIG_PARAM_NOT_FOUND_PAGE_CODE);
   assertEquals(param, "notfound");
 }