Пример #1
0
 public Renderer() 
 {
     processor = Processor.Instance;
     renderer = new HtmlRenderer();
     containerConfig = JsonContainerConfig.Instance;
     lockedDomainService = HashLockedDomainService.Instance;
 }
Пример #2
0
  /**
 * @param messageBundleFactory Used for injecting message bundles into gadget output.
 */
  public RenderingContentRewriter()
  {
      messageBundleFactory = DefaultMessageBundleFactory.Instance;
      containerConfig = JsonContainerConfig.Instance;
      featureRegistry = GadgetFeatureRegistry.Instance;
      urlGenerator = DefaultUrlGenerator.Instance;
  }
Пример #3
0
 private Processor()
 {
     gadgetSpecFactory = DefaultGadgetSpecFactory.Instance;
     substituter = new VariableSubstituter();
     blacklist = new BasicGadgetBlacklist("");
     containerConfig = JsonContainerConfig.Instance;
 }
Пример #4
0
        /**
        * Create a LockedDomainService
        * @param config per-container configuration
        * @param embedHost host name to use for embedded content
        * @param enabled whether this service should do anything at all.
        */
        public HashLockedDomainService(ContainerConfig config, bool enabled)
        {
            this.enabled = enabled;
            lockedSuffixes = new Dictionary<string,string>();
            required = new Dictionary<string,bool>();
            ICollection<String> containers = config.GetContainers();
            if (enabled) 
            {
                foreach(String container in containers) 
                {
                    String suffix = config.Get(container, LOCKED_DOMAIN_SUFFIX_KEY);
                    if (suffix == null)
                    {

                    } 
                    else 
                    {
                        lockedSuffixes.Add(container, suffix);
                    }
                    String require = config.Get(container, LOCKED_DOMAIN_REQUIRED_KEY);
                    required.Add(container, "true".Equals(require));
                }
            }
        }
Пример #5
0
 /**
 * Fetches js configuration for the given feature set & container.
 *
 * @param config The configuration to extract js config from.
 * @param context The request context.
 * @param features A set of all features needed.
 */
 public static JsonObject GetJsConfig(ContainerConfig config, GadgetContext context, HashSet<string> features)
 {
     JsonObject containerFeatures = config.GetJsonObject(context.getContainer(),
                                                         "gadgets.features");
     JsonObject retv = new JsonObject();
     if (containerFeatures != null)
     {
         foreach (string feat in features)
         {
             if (containerFeatures.Contains(feat))
             {
                 retv.Put(feat, containerFeatures[feat]);
             }
         }
     }
     return retv;
 }