Package org.osforce.spring4me.web.cache

Examples of org.osforce.spring4me.web.cache.WidgetCacheService


      return EVAL_PAGE;
    }
    //
    StringBuffer buffer = new StringBuffer();
    for(WidgetConfig widgetConfig : widgetConfigList) {
      WidgetCacheService cacheService = getWidgetCacheService();
      Object value = cacheService.get(widgetConfig);
      //
      if(StringUtils.isBlank(widgetConfig.getCache()) || value==null) {
        pageContext.getRequest().setAttribute(WidgetConfig.KEY, widgetConfig);
        pageContext.getRequest().setAttribute(WidgetConfig.NAME, widgetConfig);
        try {
          final ByteArrayOutputStream baos = new ByteArrayOutputStream();
          final HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
          final HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
          pageContext.getRequest().getRequestDispatcher(widgetConfig.getPath())
              .include(request, new GenericResponseWrapper(response, baos));
          //
          value = (baos.toString("UTF-8"));
        } catch (ServletException e) {
          e.printStackTrace();
        } catch (IOException e) {
          e.printStackTrace();
        }
        pageContext.getRequest().removeAttribute(WidgetConfig.NAME);
        pageContext.getRequest().removeAttribute(WidgetConfig.KEY);
      }
      //
      if(StringUtils.isNotBlank(widgetConfig.getCache())) {
        cacheService.put(widgetConfig, value);
      }
      //
      if(StringUtils.isNotBlank((String) value))  {
        buffer.append((String) value);
      }
View Full Code Here


      try {
        this.cacheService =  getWebApplicationContext().getBean(WidgetCacheService.class);
      } catch(NoSuchBeanDefinitionException e) {
        LoggerFactory.getLogger(WidgetCacheService.class).warn("No widget cache service configed!");
        //
        this.cacheService = new WidgetCacheService(){
          public Object get(Object key) {
            return null;
          }
          public void put(Object key, Object value) {
          }
View Full Code Here

TOP

Related Classes of org.osforce.spring4me.web.cache.WidgetCacheService

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.