Package org.infoglue.deliver.controllers.kernel.impl.simple

Examples of org.infoglue.deliver.controllers.kernel.impl.simple.TemplateController


  private String defaultValue;

  @Override
  public int doEndTag() throws JspException
  {
    TemplateController tc = getController();
    if (logger.isInfoEnabled())
    {
      logger.info("Getting value for key <" + key + ">. SiteNode.id: " + tc.getSiteNodeId() + ". Component.id: " + tc.getComponentContentId());
    }

    produceResult(tc.getGeneralSetting(key, defaultValue));

    this.key = null;
    this.defaultValue = null;
    return EVAL_PAGE;
  }
View Full Code Here


        BrowserBean browserBean = new BrowserBean();
      //this.browserBean.setRequest(getRequest());

    NodeDeliveryController nodeDeliveryController = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId);
    IntegrationDeliveryController integrationDeliveryController  = IntegrationDeliveryController.getIntegrationDeliveryController(siteNodeId, languageId, contentId);
    TemplateController templateController = getTemplateController(dbWrapper, siteNodeId, languageId, contentId, new FakeHttpServletRequest(), (InfoGluePrincipal)principal, false, browserBean, nodeDeliveryController, integrationDeliveryController);
   
    DeliveryContext deliveryContext = DeliveryContext.getDeliveryContext(/*(InfoGluePrincipal)this.principal*/);
    //deliveryContext.setRepositoryName(repositoryName);
    deliveryContext.setSiteNodeId(siteNodeId);
    deliveryContext.setContentId(contentId);
    deliveryContext.setLanguageId(languageId);
    deliveryContext.setPageKey("" + System.currentTimeMillis());
    //deliveryContext.setSession(new Session(fakeHttpServletSession));
    //deliveryContext.setInfoGlueAbstractAction(null);
    deliveryContext.setHttpServletRequest(fakeHttpServletRequest);
    deliveryContext.setHttpServletResponse(fakeHttpServletResponse);

    templateController.setDeliveryContext(deliveryContext);
   
    //We don't want a page cache entry to be created
    deliveryContext.setDisablePageCache(true);

    SiteNodeVO siteNodeVO = templateController.getSiteNode(siteNodeId);
    SiteNodeVO rootSiteNodeVO = templateController.getRepositoryRootSiteNode(siteNodeVO.getRepositoryId());
   
    recurseSiteNodeTree(rootSiteNodeVO.getId(), languageId, templateController, principal/*, dbWrapper*/, 1, 0);

    List templates = ContentController.getContentController().getContentVOWithContentTypeDefinition("HTMLTemplate", dbWrapper.getDatabase());
    Iterator templatesIterator = templates.iterator();
    {
        ContentVO template = (ContentVO)templatesIterator.next();

        String templateString = templateController.getContentAttribute(template.getId(), languageId, "Template", true);
    }
   
    RepositoryVO repository = RepositoryDeliveryController.getRepositoryDeliveryController().getMasterRepository(dbWrapper.getDatabase());
   
    RepositoryDeliveryController.getRepositoryDeliveryController().getRepositoryVOListFromServerName(dbWrapper.getDatabase(), "localhost", "8080", repository.getName(), "");
View Full Code Here

        BrowserBean browserBean = new BrowserBean();
      //this.browserBean.setRequest(getRequest());
     
    NodeDeliveryController nodeDeliveryController = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId);
    IntegrationDeliveryController integrationDeliveryController  = IntegrationDeliveryController.getIntegrationDeliveryController(siteNodeId, languageId, contentId);
    TemplateController subTemplateController = getTemplateController(templateController.getDatabaseWrapper(), siteNodeId, languageId, contentId, new FakeHttpServletRequest(), (InfoGluePrincipal)principal, false, browserBean, nodeDeliveryController, integrationDeliveryController);

    DeliveryContext deliveryContext = DeliveryContext.getDeliveryContext(/*(InfoGluePrincipal)this.principal*/);
    //deliveryContext.setRepositoryName(repositoryName);
    deliveryContext.setSiteNodeId(siteNodeId);
    deliveryContext.setContentId(contentId);
    deliveryContext.setLanguageId(languageId);
    deliveryContext.setPageKey("" + System.currentTimeMillis());
    //deliveryContext.setSession(new Session(fakeHttpServletSession));
    //deliveryContext.setInfoGlueAbstractAction(null);
    deliveryContext.setHttpServletRequest(fakeHttpServletRequest);
    deliveryContext.setHttpServletResponse(fakeHttpServletResponse);

    subTemplateController.setDeliveryContext(deliveryContext);
   
    //We don't want a page cache entry to be created
    deliveryContext.setDisablePageCache(true);

    SiteNodeVO rootSiteNodeVO = templateController.getRepositoryRootSiteNode(siteNodeVO.getRepositoryId());

    String pagePath = subTemplateController.getCurrentPagePath();
       
    CacheController.cacheObject("newPagePathCache", deliveryContext.getPageKey(), pagePath);
  }
View Full Code Here

   * normal site-delivery version.
   */
 
  public TemplateController getTemplateController(DatabaseWrapper dbWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infoGluePrincipal, boolean allowEditOnSightAtAll, BrowserBean browserBean, NodeDeliveryController nodeDeliveryController, IntegrationDeliveryController integrationDeliveryController) throws SystemException, Exception
  {
    TemplateController templateController = new BasicTemplateController(dbWrapper, infoGluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setBrowserBean(browserBean);
    templateController.setDeliveryControllers(nodeDeliveryController, null, integrationDeliveryController)
   
    return templateController;   
  }
View Full Code Here

      logger.error("Error rendering template[" + componentName + "]. You should fix this. Find more information in the warning log.");
      logger.warn("Error rendering template:" + e.getMessage(), e);
      logger.info("templateAsString: \n" + (templateAsString.length() > 500 ? templateAsString.substring(0, 500) + "... (template truncated)." : templateAsString));
       
      //If error we don't want the error cached - right?
      TemplateController templateController = (TemplateController)params.get("templateLogic");
      if(templateController != null)
      {
        DeliveryContext deliveryContext = templateController.getDeliveryContext();
        deliveryContext.setDisablePageCache(true);
      }
     
        if(CmsPropertyHandler.getOperatingMode().equalsIgnoreCase("0") && (CmsPropertyHandler.getDisableTemplateDebug() == null || !CmsPropertyHandler.getDisableTemplateDebug().equalsIgnoreCase("true")))
            pw.println("Error rendering template:" + e.getMessage());
View Full Code Here

            fpw.close();
        }
    }

      final ScriptController scriptController = (ScriptController)params.get("scriptLogic");
      final TemplateController templateController = (TemplateController)params.get("templateLogic");
      final PortalController portletController = (PortalController)params.get("portalLogic");
      final Map<String,Object> model = (Map<String,Object>)params.get("model");
      if(templateController != null)
      {
        final DeliveryContext deliveryContext = templateController.getDeliveryContext();
      //logger.info("renderJSP: ClassLoader in context for thread:" + Thread.currentThread().getId() + ":" + Thread.currentThread().getContextClassLoader().getClass().getName());

        templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.templateLogic", templateController);
        templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.portalLogic", portletController);
        templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.classLoader", Thread.currentThread().getContextClassLoader());
        templateController.getHttpServletRequest().setAttribute("model", model);
        final CharResponseWrapper wrapper = new CharResponseWrapper(deliveryContext.getHttpServletResponse());
        final RequestDispatcher dispatch = templateController.getHttpServletRequest().getRequestDispatcher("/jsp/" + fileName);
        dispatch.include(templateController.getHttpServletRequest(), wrapper);

        pw.println(wrapper.toCharArray());
      }
      else if(scriptController != null)
      {
View Full Code Here

          logger.info("Time for renaming file " + timer.getElapsedTime());
        }         
      }
    }
   
    TemplateController templateController = (TemplateController)params.get("templateLogic");
    PortalController portletController = (PortalController)params.get("portalLogic");
    DeliveryContext deliveryContext = templateController.getDeliveryContext();
      RequestDispatcher dispatch = templateController.getHttpServletRequest().getRequestDispatcher("/jsp/Template_" + hashCode + ".jsp");
    templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.templateLogic", templateController);
    templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.portalLogic", portletController);
      templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.classLoader", Thread.currentThread().getContextClassLoader());
      CharResponseWrapper wrapper = new CharResponseWrapper(deliveryContext.getHttpServletResponse());
   
      dispatch.include(templateController.getHttpServletRequest(), wrapper);

      String result = wrapper.toString();

      pw.println(result);
  }
View Full Code Here

            fpw.close();
        }
    }

      final ScriptController scriptController = (ScriptController)params.get("scriptLogic");
      final TemplateController templateController = (TemplateController)params.get("templateLogic");
      final PortalController portletController = (PortalController)params.get("portalLogic");
      final Map<String,Object> model = (Map<String,Object>)params.get("model");

      byte[] result = null;
      if(templateController != null)
      {
        final DeliveryContext deliveryContext = templateController.getDeliveryContext();
     
        templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.templateLogic", templateController);
        templateController.getHttpServletRequest().setAttribute("org.infoglue.cms.deliver.portalLogic", portletController);
        templateController.getHttpServletRequest().setAttribute("model", model);
        try
        {
          QuercusContext quercus = new QuercusContext();
          quercus.setServletContext(deliveryContext.getHttpServletRequest().getSession().getServletContext());
          Path pwd = new FilePath(CmsPropertyHandler.getContextRootPath());
View Full Code Here

  public TemplateController getTemplateController(DatabaseWrapper databaseWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infogluePrincipal) throws Exception
  {
      NodeDeliveryController nodeDeliveryController        = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId);
    IntegrationDeliveryController integrationDeliveryController  = IntegrationDeliveryController.getIntegrationDeliveryController(siteNodeId, languageId, contentId);
   
    TemplateController templateController = new BasicTemplateController(databaseWrapper, infogluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setDeliveryControllers(nodeDeliveryController, null, integrationDeliveryController)
    return templateController;   
  }
View Full Code Here

   * normal site-delivery version.
   */
 
  public TemplateController getTemplateController(DatabaseWrapper dbWrapper, Integer siteNodeId, Integer languageId, Integer contentId, HttpServletRequest request, InfoGluePrincipal infoGluePrincipal, boolean allowEditOnSightAtAll) throws SystemException, Exception
  {
    TemplateController templateController = new BasicTemplateController(dbWrapper, infoGluePrincipal);
    templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
    templateController.setHttpRequest(request)
    templateController.setBrowserBean(browserBean);
    templateController.setDeliveryControllers(this.nodeDeliveryController, null, this.integrationDeliveryController)
   
    String operatingMode = CmsPropertyHandler.getOperatingMode();
   
    if(operatingMode != null && (operatingMode.equals("0") || operatingMode.equals("1") || operatingMode.equals("2")))
    {
        String editOnSite = CmsPropertyHandler.getEditOnSite();
      boolean isEditOnSightDisabled = templateController.getIsEditOnSightDisabled();
     
      if(allowEditOnSightAtAll && !isEditOnSightDisabled && editOnSite != null && editOnSite.equalsIgnoreCase("true"))
      {
        templateController = new EditOnSiteBasicTemplateController(dbWrapper, infoGluePrincipal);
        templateController.setStandardRequestParameters(siteNodeId, languageId, contentId)
        templateController.setHttpRequest(request)
        templateController.setBrowserBean(browserBean);
        templateController.setDeliveryControllers(this.nodeDeliveryController, null, this.integrationDeliveryController)
      }
    }
   
    return templateController;   
  }
View Full Code Here

TOP

Related Classes of org.infoglue.deliver.controllers.kernel.impl.simple.TemplateController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.