Package org.osforce.spring4me.web.widget.config

Examples of org.osforce.spring4me.web.widget.config.WidgetConfig


        final ByteArrayOutputStream outstr = new ByteArrayOutputStream();
        final GenericResponseWrapper wrapper = new GenericResponseWrapper(response, outstr);
        chain.doFilter(request, wrapper);
        wrapper.flush();
        //
        WidgetConfig widgetConfig = (WidgetConfig) request
        .getAttribute(WidgetConfig.KEY);
        Long timeToLiveSeconds = parseTimeToLiveSeconds(widgetConfig.getCache());
        // Return the page info
        return new PageInfo(wrapper.getStatus(), wrapper.getContentType(),
                wrapper.getCookies(),
                outstr.toByteArray(), false, timeToLiveSeconds, wrapper.getAllHeaders());
  }
View Full Code Here


  protected WidgetConfig getWidgetConfig(HttpServletRequest request) {
    return (WidgetConfig) request.getAttribute(WidgetConfig.KEY);
  }
 
  protected String prepareCache(HttpServletRequest request) {
    WidgetConfig widgetConfig =getWidgetConfig(request);
    //
    StringBuffer keyBuffer = new StringBuffer(request.getRequestURI());
    if(request.getQueryString()!=null) {
      keyBuffer.append("?").append(request.getQueryString());
    }
    keyBuffer.append("T").append(widgetConfig.getId());
    Set<String> widgetIds = widgets.get(widgetConfig.getName());
    if(widgetIds==null) {
      widgetIds = new HashSet<String>();
    }
    widgetIds.add(keyBuffer.toString());
    widgets.put(widgetConfig.getName(), widgetIds);
    //
    return keyBuffer.toString();
  }
View Full Code Here

    Element element = new Element(key, value, false, getCacheTime(key), getCacheTime(key));
    getCache().put(element);
  }
 
  protected Integer getCacheTime(Object key) {
    WidgetConfig widgetConfig = (WidgetConfig) key;
    String cache = StringUtils.isNotBlank(widgetConfig.getCache()) ? widgetConfig.getCache() : "-1";
    return Integer.parseInt(cache);
  }
View Full Code Here

      for(Element widgetEle : widgetEles) {
        String nameW = XMLUtil.getAttribute(widgetEle, "name");
        String pathW = XMLUtil.getAttribute(widgetEle, "path");
        String cssClassW = XMLUtil.getAttribute(widgetEle, "cssClass");
        String cacheW = XMLUtil.getAttribute(widgetEle, "cache");
        WidgetConfig widgetConfig = new WidgetConfig(nameW, pathW, cssClassW, cacheW);
        //
        Element titleEle = XMLUtil.getChildElement(widgetEle, "title");
        if(titleEle!=null) {
          String titleW = XMLUtil.getValue(titleEle);
          widgetConfig.setTitle(titleW);
        }
        //
        Element prefsEle = XMLUtil.getChildElement(widgetEle, "prefs");
        if(prefsEle!=null) {
        List<Element> prefEles = XMLUtil.getChildElements(prefsEle);
          for(Element prefEle : prefEles) {
            String key = XMLUtil.getName(prefEle);
            String value = XMLUtil.getValue(prefEle);
            widgetConfig.addPref(key, value);
          }
        }
        pageConfig.add(nameP, widgetConfig);
      }
    }
View Full Code Here

TOP

Related Classes of org.osforce.spring4me.web.widget.config.WidgetConfig

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.