Author: theute
Date: 2011-09-14 04:37:46 -0400 (Wed, 14 Sep 2011)
New Revision: 7405
Added:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInContainerConfigLoader.java
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js
Removed:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/containers/default/container.js
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js
Modified:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml
Log:
JBEPP-1169: Move Apache Shindig JS configuration out of a jar
Deleted:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/containers/default/container.js
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/containers/default/container.js 2011-09-14
08:05:34 UTC (rev 7404)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/containers/default/container.js 2011-09-14
08:37:46 UTC (rev 7405)
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Default container configuration. To change the configuration, you have two options:
-//
-// A. If you run the Java server: Create your own "myContainer.js" file and
-// modify the value in web.xml.
-//
-// B. If you run the PHP server: Create a myContainer.js, copy the contents of
container.js to it,
-// change
-// {"gadgets.container" : ["default"],
-// to
-// {"gadgets.container" : ["myContainer"],
-// And make your changes that you need to myContainer.js.
-// Just make sure on the iframe URL you specify &container=myContainer
-// for it to use that config.
-//
-// All configurations will automatically inherit values from this
-// config, so you only need to provide configuration for items
-// that you require explicit special casing for.
-//
-// Please namespace your attributes using the same conventions
-// as you would for javascript objects, e.g. gadgets.features
-// rather than "features".
-
-// NOTE: Please _don't_ leave trailing commas because the php json parser
-// errors out on this.
-
-// Container must be an array; this allows multiple containers
-// to share configuration.
-// TODO: Move out accel container config into a separate accel.js file.
-// TODO : remove "" container
-{"gadgets.container" : ["default", "accel", ""],
-
-// Set of regular expressions to validate the parent parameter. This is
-// necessary to support situations where you want a single container to support
-// multiple possible host names (such as for localized domains, such as
-// <
language>.example.org. If left as null, the parent parameter will be
-// ignored; otherwise, any requests that do not include a parent
-// value matching this set will return a 404 error.
-"gadgets.parent" : null,
-
-// Should all gadgets be forced on to a locked domain?
-"gadgets.lockedDomainRequired" : false,
-
-// DNS domain on which gadgets should render.
-"gadgets.lockedDomainSuffix" : "-a.example.com:8080",
-// Origins for CORS requests and/or Referer validation
-// Indicate a set of origins or an entry with * to indicate that all origins are allowed
-"gadgets.parentOrigins" : ["*"],
-
-// Various urls generated throughout the code base.
-// iframeBaseUri will automatically have the host inserted
-// if locked domain is enabled and the implementation supports it.
-// query parameters will be added.
-"gadgets.iframeBaseUri" : "/eXoGadgetServer/gadgets/ifr",
-"gadgets.uri.iframe.basePath" : "/eXoGadgetServer/gadgets/ifr",
-
-// jsUriTemplate will have %host% and %js% substituted.
-// No locked domain special cases, but jsUriTemplate must
-// never conflict with a lockedDomainSuffix.
-"gadgets.jsUriTemplate" :
"http://%host%/eXoGadgetServer/gadgets/js/%js%",
-
-//New configuration for iframeUri generation:
-"gadgets.uri.iframe.lockedDomainSuffix" : "-a.example.com:8080",
-"gadgets.uri.iframe.unlockedDomain" : "http://%host%",
-"gadgets.uri.iframe.basePath" : "/eXoGadgetServer/gadgets/ifr",
-// Callback URL. Scheme relative URL for easy switch between https/http.
-"gadgets.uri.oauth.callbackTemplate" :
"//%host%/eXoGadgetServer/gadgets/oauthcallback",
-
-// Use an insecure security token by default
-"gadgets.securityTokenType" : "secure",
-"gadgets.securityTokenKeyFile" : "key.txt",
-
-// Config param to load Opensocial data for social
-// preloads in data pipelining. %host% will be
-// substituted with the current host.
-"gadgets.osDataUri" : "http://%host%/rpc",
-"gadgets.signingKeyFile" : "oauthkey.pem",
-"gadgets.signingKeyName" : "mytestkey",
-
-"gadgets.signedFetchDomain" : "eXo",
-
-"gadgets.content-rewrite" : {
- "include-urls": ".*",
- "exclude-urls": "",
- "include-tags": ["link", "script", "embed",
"img", "style"],
- "expires": "86400",
- "proxy-url": "/eXoGadgetServer/gadgets/proxy?url=",
- "concat-url": "/eXoGadgetServer/gadgets/concat?"
-},
-// Default Js Uri config: also must be overridden.
-"gadgets.uri.js.host" : "http://%host%/",
-"gadgets.uri.js.path" : "/eXoGadgetServer/gadgets/js",
-
-// Default concat Uri config; used for testing.
-"gadgets.uri.concat.host" : "%host%",
-"gadgets.uri.concat.path" : "/eXoGadgetServer/gadgets/concat",
-"gadgets.uri.concat.js.splitToken" : "false",
-
-// Default proxy Uri config; used for testing.
-"gadgets.uri.proxy.host" : "%host%",
-"gadgets.uri.proxy.path" : "/eXoGadgetServer/gadgets/proxy",
-
-// This config data will be passed down to javascript. Please
-// configure your object using the feature name rather than
-// the javascript name.
-
-// Only configuration for required features will be used.
-// See individual feature.xml files for configuration details.
-"gadgets.features" : {
- "core.io" : {
- // Note: /proxy is an open proxy. Be careful how you expose this!
- "proxyUrl" :
"//%host%/eXoGadgetServer/gadgets/proxy?container=default&refresh=%refresh%&url=%url%%rewriteMime%",
- "jsonProxyUrl" : "//%host%/eXoGadgetServer/gadgets/makeRequest"
- },
- "views" : {
- "home" : {
- "isOnlyVisible" : false,
- "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/home?{var}",
- "aliases": ["DASHBOARD", "default"]
- },
- "canvas" : {
- "isOnlyVisible" : true,
- "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/canvas?{var}",
- "aliases" : ["FULL_PAGE"]
- }
- },
- "tabs": {
- "css" : [
- ".tablib_table {",
- "width: 100%;",
- "border-collapse: separate;",
- "border-spacing: 0px;",
- "empty-cells: show;",
- "font-size: 11px;",
- "text-align: center;",
- "}",
- ".tablib_emptyTab {",
- "border-bottom: 1px solid #676767;",
- "padding: 0px 1px;",
- "}",
- ".tablib_spacerTab {",
- "border-bottom: 1px solid #676767;",
- "padding: 0px 1px;",
- "width: 1px;",
- "}",
- ".tablib_selected {",
- "padding: 2px;",
- "background-color: #ffffff;",
- "border: 1px solid #676767;",
- "border-bottom-width: 0px;",
- "color: #3366cc;",
- "font-weight: bold;",
- "width: 80px;",
- "cursor: default;",
- "}",
- ".tablib_unselected {",
- "padding: 2px;",
- "background-color: #dddddd;",
- "border: 1px solid #aaaaaa;",
- "border-bottom-color: #676767;",
- "color: #000000;",
- "width: 80px;",
- "cursor: pointer;",
- "}",
- ".tablib_navContainer {",
- "width: 10px;",
- "vertical-align: middle;",
- "}",
- ".tablib_navContainer a:link, ",
- ".tablib_navContainer a:visited, ",
- ".tablib_navContainer a:hover {",
- "color: #3366aa;",
- "text-decoration: none;",
- "}"
- ]
- },
- "minimessage": {
- "css": [
- ".mmlib_table {",
- "width: 100%;",
- "font: bold 9px arial,sans-serif;",
- "background-color: #fff4c2;",
- "border-collapse: separate;",
- "border-spacing: 0px;",
- "padding: 1px 0px;",
- "}",
- ".mmlib_xlink {",
- "font: normal 1.1em arial,sans-serif;",
- "font-weight: bold;",
- "color: #0000cc;",
- "cursor: pointer;",
- "}"
- ]
- },
- "rpc" : {
- // Path to the relay file. Automatically appended to the parent
- /// parameter if it passes input validation and is not null.
- // This should never be on the same host in a production environment!
- // Only use this for TESTING!
- "parentRelayUrl" :
"/eXoGadgetServer/gadgets/files/container/rpc_relay.html",
-
- // If true, this will use the legacy ifpc wire format when making rpc
- // requests.
- "useLegacyProtocol" : false
- },
- // Skin defaults
- "skins" : {
- "properties" : {
- "BG_COLOR": "",
- "BG_IMAGE": "",
- "BG_POSITION": "",
- "BG_REPEAT": "",
- "FONT_COLOR": "",
- "ANCHOR_COLOR": ""
- }
- },
- "opensocial" : {
- // Path to fetch opensocial data from
- // Must be on the same domain as the gadget rendering server
- "path" : "http://%host%/rpc",
- // Path to issue invalidate calls
- "invalidatePath" : "http://%host%/rpc",
- "domain" : "shindig",
- "enableCaja" : false,
- "supportedFields" : {
- "person" : ["id", {"name" : ["familyName",
"givenName", "unstructured"]}, "thumbnailUrl",
"profileUrl"],
- "activity" : ["appId", "body", "bodyId",
"externalId", "id", "mediaItems", "postedTime",
"priority",
- "streamFaviconUrl", "streamSourceUrl",
"streamTitle", "streamUrl", "templateParams",
"title",
- "url", "userId"],
- "activityEntry" : ["icon", "postedTime",
"actor", "verb", "object", "target",
"generator", "provider", "title",
- "body", "standardLinks", "to",
"cc", "bcc"],
- "album" : ["id", "thumbnailUrl", "title",
"description", "location", "ownerId"],
- "mediaItem" : ["album_id", "created",
"description", "duration", "file_size", "id",
"language", "last_updated",
- "location", "mime_type",
"num_comments", "num_views", "num_votes",
"rating", "start_time",
- "tagged_people", "tags",
"thumbnail_url", "title", "type", "url"]
- }
- },
- "osapi.services" : {
- // Specifying a binding to "container.listMethods" instructs osapi to
dynamicaly introspect the services
- // provided by the container and delay the gadget onLoad handler until that
introspection is
- // complete.
- // Alternatively a container can directly configure services here rather than having
them
- // introspected. Simply list out the available servies and omit
"container.listMethods" to
- // avoid the initialization delay caused by gadgets.rpc
- // E.g. "gadgets.rpc" : ["activities.requestCreate",
"messages.requestSend", "requestShareApp",
"requestPermission"]
- "gadgets.rpc" : ["container.listMethods"]
- },
- "osapi" : {
- // The endpoints to query for available JSONRPC/REST services
- "endPoints" : [ "http://%host%/rpc" ]
- },
- "osml": {
- // OSML library resource. Can be set to null or the empty string to disable OSML
- // for a container.
- "library": "config/OSML_library.xml"
- }
-}}
Modified:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java 2011-09-14
08:05:34 UTC (rev 7404)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ExoContainerConfig.java 2011-09-14
08:37:46 UTC (rev 7405)
@@ -27,7 +27,6 @@
import org.apache.shindig.auth.BlobCrypterSecurityTokenCodec;
import org.apache.shindig.config.ContainerConfigException;
-import org.apache.shindig.config.JsonContainerConfig;
import org.apache.shindig.expressions.Expressions;
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.Safe;
@@ -63,7 +62,7 @@
@Singleton
public class
- ExoContainerConfig extends JsonContainerConfig
+ ExoContainerConfig extends GateInJsonContainerConfig
{
/** . */
Copied:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInContainerConfigLoader.java
(from rev 5761,
portal/branches/branch-GTNPORTAL-1745/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInContainerConfigLoader.java)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInContainerConfigLoader.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInContainerConfigLoader.java 2011-09-14
08:37:46 UTC (rev 7405)
@@ -0,0 +1,18 @@
+package org.exoplatform.portal.gadget.core;
+
+import javax.servlet.ServletContext;
+import java.io.IOException;
+
+/**
+ * A generic loader, used to load gadget server configuration files. We abuse the
ThreadLocal here, as there is no way
+ * to associate Guice components with Kernel 's configuration loader component
(ConfigurationManager)
+ *
+ * User: Minh Hoang TO - hoang281283(a)gmail.com
+ * Date: 1/12/11
+ * Time: 3:31 PM
+ */
+public abstract class GateInContainerConfigLoader {
+
+ public abstract String loadContentAsString(String path, String encoding) throws
IOException;
+
+}
Copied:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java
(from rev 5761,
portal/branches/branch-GTNPORTAL-1745/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInGuiceServletContextListener.java 2011-09-14
08:37:46 UTC (rev 7405)
@@ -0,0 +1,69 @@
+package org.exoplatform.portal.gadget.core;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.shindig.common.servlet.GuiceServletContextListener;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ *
+ * Extending the GuiceServletContextListener to setup a
ThreadLocal<GateInContainerConfigLoader> variable wrapping
+ * the ServletContext. That makes the ServletContext accessible within the scope of
thread executing the method
+ * contextInitialized
+ *
+ *
+ * User: Minh Hoang TO - hoang281283(a)gmail.com
+ * Date: 1/12/11
+ * Time: 3:50 PM
+ */
+public class GateInGuiceServletContextListener extends GuiceServletContextListener {
+
+ private static ThreadLocal<GateInContainerConfigLoader> currentLoader = new
ThreadLocal<GateInContainerConfigLoader>();
+
+ @Override
+ public void contextInitialized(ServletContextEvent event) {
+
+ final ServletContext scontext = event.getServletContext();
+
+ GateInContainerConfigLoader loader = new GateInContainerConfigLoader() {
+ @Override
+ public String loadContentAsString(String path, String encoding) throws
IOException{
+
+ InputStream is = scontext.getResourceAsStream(path);
+
+ if(is == null)
+ {
+ throw new NullPointerException("There is no file specified by path :
" + path);
+ }
+ return IOUtils.toString(is, encoding);
+ }
+ };
+
+ //Setup the threadlocal loader
+ currentLoader.set(loader);
+
+ try
+ {
+ //Setup the Guice objects, the threadlocal loader is accessible for the moment
+ super.contextInitialized(event);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ //Reset the threadlocal loader to null
+ currentLoader.set(null);
+ }
+
+ }
+
+ public static GateInContainerConfigLoader getCurrentLoader()
+ {
+ return currentLoader.get();
+ }
+}
Copied:
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java
(from rev 5715,
portal/branches/branch-GTNPORTAL-1745/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/GateInJsonContainerConfig.java 2011-09-14
08:37:46 UTC (rev 7405)
@@ -0,0 +1,404 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+
+package org.exoplatform.portal.gadget.core;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shindig.common.JsonSerializer;
+import org.apache.shindig.common.util.ResourceLoader;
+import org.apache.shindig.config.AbstractContainerConfig;
+import org.apache.shindig.config.ContainerConfigELResolver;
+import org.apache.shindig.config.ContainerConfigException;
+import org.apache.shindig.config.DynamicConfigProperty;
+import org.apache.shindig.expressions.Expressions;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.name.Named;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+
+/**
+ * A fork of the class JsonContainerConfig, designed to override the loading of
container.js
+ *
+ * User: Minh Hoang TO - hoang281283(a)gmail.com
+ * Date: 1/10/11
+ * Time: 2:12 PM
+ */
+@Singleton
+public class GateInJsonContainerConfig extends AbstractContainerConfig {
+
+ private static final Logger LOG =
Logger.getLogger(GateInJsonContainerConfig.class.getName());
+ public static final char FILE_SEPARATOR = ',';
+ public static final String PARENT_KEY = "parent";
+ // TODO: Rename this to simply "container", gadgets.container is
unnecessary.
+ public static final String CONTAINER_KEY = "gadgets.container";
+
+ private final Map<String, Map<String, Object>> config;
+ private final Expressions expressions;
+
+ /**
+ * Creates a new configuration from files.
+ * @throws ContainerConfigException
+ */
+ @Inject
+ public GateInJsonContainerConfig((a)Named("shindig.containers.default") String
containers, Expressions expressions)
+ throws ContainerConfigException {
+ this.expressions = expressions;
+ config = createContainers(loadContainers(containers));
+ init();
+ }
+
+ /**
+ * Creates a new configuration from a JSON Object, for use in testing.
+ */
+ public GateInJsonContainerConfig(JSONObject json, Expressions expressions) {
+ this.expressions = expressions;
+ config = createContainers(json);
+ init();
+ }
+
+ /**
+ * Initializes the configuration. Called during construction.
+ */
+ protected void init() {
+ for (Map.Entry<String, Map<String, Object>> configEntry :
config.entrySet()) {
+ @SuppressWarnings("unchecked")
+ Map<String, Object> value = (Map<String, Object>)
evaluateAll(configEntry.getValue());
+ configEntry.setValue(value);
+ }
+ }
+
+ @Override
+ public Collection<String> getContainers() {
+ return Collections.unmodifiableSet(config.keySet());
+ }
+
+ @Override
+ public Map<String, Object> getProperties(String container) {
+ return config.get(container);
+ }
+
+ @Override
+ public Object getProperty(String container, String property) {
+ if (property.startsWith("${")) {
+ // An expression!
+ try {
+ ValueExpression expression = expressions.parse(property, Object.class);
+ return expression.getValue(createExpressionContext(container));
+ } catch (ELException e) {
+ return null;
+ }
+ }
+
+ Map<String, Object> containerData = config.get(container);
+ if (containerData == null) {
+ return null;
+ }
+ return containerData.get(property);
+ }
+
+ /**
+ * Initialize each container's configuration.
+ */
+ private Map<String, Map<String, Object>> createContainers(JSONObject json)
{
+ Map<String, Map<String, Object>> map = Maps.newHashMap();
+ for (String container : JSONObject.getNames(json)) {
+ ELContext context = createExpressionContext(container);
+ map.put(container, jsonToMap(json.optJSONObject(container), expressions,
context));
+ }
+
+ return map;
+ }
+
+ /**
+ * Make Expressions available to subclasses so they can create ELContexts
+ */
+ protected Expressions getExpressions() {
+ return expressions;
+ }
+
+ /**
+ * Protected to allow overriding.
+ */
+ protected ELContext createExpressionContext(String container) {
+ return getExpressions().newELContext(new ContainerConfigELResolver(this,
container));
+ }
+
+ /**
+ * Convert a JSON value to a configuration value.
+ */
+ private static Object jsonToConfig(Object json, Expressions expressions, ELContext
context) {
+ if (JSONObject.NULL.equals(json)) {
+ return null;
+ } else if (json instanceof CharSequence) {
+ return new DynamicConfigProperty(json.toString(), expressions, context);
+ } else if (json instanceof JSONArray) {
+ JSONArray jsonArray = (JSONArray) json;
+ List<Object> values = new ArrayList<Object>(jsonArray.length());
+ for (int i = 0, j = jsonArray.length(); i < j; ++i) {
+ values.add(jsonToConfig(jsonArray.opt(i), expressions, context));
+ }
+ return Collections.unmodifiableList(values);
+ } else if (json instanceof JSONObject) {
+ return jsonToMap((JSONObject) json, expressions, context);
+ }
+
+ // A (boxed) primitive.
+ return json;
+ }
+
+ private static Map<String, Object> jsonToMap(JSONObject json, Expressions
expressions, ELContext context) {
+ Map<String, Object> values = new HashMap<String, Object>(json.length(),
1);
+ for (String key : JSONObject.getNames(json)) {
+ Object val = jsonToConfig(json.opt(key), expressions, context);
+ if (val != null) {
+ values.put(key, val);
+ }
+ }
+ return Collections.unmodifiableMap(values);
+ }
+
+ /**
+ * Loads containers from directories recursively.
+ *
+ * Only files with a .js or .json extension will be loaded.
+ *
+ * @param files The files to examine.
+ * @throws ContainerConfigException
+ */
+ private void loadFiles(File[] files, JSONObject all) throws ContainerConfigException {
+ try {
+ for (File file : files) {
+ LOG.info("Reading container config: " + file.getName());
+ if (file.isDirectory()) {
+ loadFiles(file.listFiles(), all);
+ } else if (file.getName().toLowerCase(Locale.ENGLISH).endsWith(".js")
||
+
file.getName().toLowerCase(Locale.ENGLISH).endsWith(".json")) {
+ if (!file.exists()) {
+ throw new ContainerConfigException(
+ "The file '" + file.getAbsolutePath() + "'
doesn't exist.");
+ }
+ loadFromString(ResourceLoader.getContent(file), all);
+ } else {
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.finest(file.getAbsolutePath() + " doesn't seem to be a JS or
JSON file.");
+ }
+ }
+ } catch (IOException e) {
+ throw new ContainerConfigException(e);
+ }
+ }
+
+ /**
+ * Loads resources recursively.
+ * @param files The base paths to look for container.xml
+ * @throws ContainerConfigException
+ */
+ private void loadResources(String[] files, JSONObject all) throws
ContainerConfigException {
+ try {
+ for (String entry : files) {
+ LOG.info("Reading container config: " + entry);
+ //final ClassLoader contextCl = Thread.currentThread().getContextClassLoader();
+ //InputStream resourceInputStream = contextCl.getResourceAsStream(entry);
+ //String content = IOUtils.toString(resourceInputStream, "UTF-8");
+
+ GateInContainerConfigLoader currentLoader =
GateInGuiceServletContextListener.getCurrentLoader();
+ String content = currentLoader.loadContentAsString(entry, "UTF-8");
+ loadFromString(content, all);
+ }
+ } catch (IOException e) {
+ throw new ContainerConfigException(e);
+ }
+ }
+
+ /**
+ * Merges two JSON objects together (recursively), with values from "merge"
+ * replacing values in "base" to produce a new object.
+ *
+ * @param base The base object that values will be replaced into.
+ * @param merge The object to merge values from.
+ *
+ * @throws JSONException if the two objects can't be merged for some reason.
+ */
+ private JSONObject mergeObjects(JSONObject base, JSONObject merge)
+ throws JSONException {
+ // Clone the initial object (JSONObject doesn't support "clone").
+
+ JSONObject clone = new JSONObject(base, JSONObject.getNames(base));
+ // Walk parameter list for the merged object and merge recursively.
+ String[] fields = JSONObject.getNames(merge);
+ for (String field : fields) {
+ Object existing = clone.opt(field);
+ Object update = merge.get(field);
+ if (JSONObject.NULL.equals(existing) || JSONObject.NULL.equals(update)) {
+ // It's new custom config, not referenced in the prototype, or
+ // it's removing a pre-configured value.
+ clone.put(field, update);
+ } else {
+ // Merge if object type is JSONObject.
+ if (update instanceof JSONObject &&
+ existing instanceof JSONObject) {
+ clone.put(field, mergeObjects((JSONObject)existing,
+ (JSONObject)update));
+ } else {
+ // Otherwise we just overwrite it.
+ clone.put(field, update);
+ }
+ }
+ }
+ return clone;
+ }
+
+ /**
+ * Recursively merge values from parent objects in the prototype chain.
+ *
+ * @return The object merged with all parents.
+ *
+ * @throws ContainerConfigException If there is an invalid parent parameter
+ * in the prototype chain.
+ */
+ private JSONObject mergeParents(String container, JSONObject all)
+ throws ContainerConfigException, JSONException {
+ JSONObject base = all.getJSONObject(container);
+ if (DEFAULT_CONTAINER.equals(container)) {
+ return base;
+ }
+
+ String parent = base.optString(PARENT_KEY, DEFAULT_CONTAINER);
+ if (!all.has(parent)) {
+ throw new ContainerConfigException(
+ "Unable to locate parent '" + parent + "' required by
"
+ + base.getString(CONTAINER_KEY));
+ }
+ return mergeObjects(mergeParents(parent, all), base);
+ }
+
+ /**
+ * Processes a container file.
+ *
+ * @param json
+ * @throws ContainerConfigException
+ */
+ protected void loadFromString(String json, JSONObject all) throws
ContainerConfigException {
+ try {
+ JSONObject contents = new JSONObject(json);
+ JSONArray containers = contents.getJSONArray(CONTAINER_KEY);
+
+ for (int i = 0, j = containers.length(); i < j; ++i) {
+ // Copy the default object and produce a new one.
+ String container = containers.getString(i);
+ all.put(container, contents);
+ }
+ } catch (JSONException e) {
+ throw new ContainerConfigException(e);
+ }
+ }
+
+ /**
+ * Loads containers from the specified resource. Follows the same rules
+ * as {@code JsFeatureLoader.loadFeatures} for locating resources.
+ *
+ * @param path
+ * @throws ContainerConfigException
+ */
+ private JSONObject loadContainers(String path) throws ContainerConfigException {
+ JSONObject all = new JSONObject();
+ try {
+ for (String location : StringUtils.split(path, FILE_SEPARATOR)) {
+ if (location.startsWith("res://")) {
+ location = location.substring(6);
+ LOG.info("Loading resources from: " + location);
+ if (path.endsWith(".txt")) {
+ loadResources(ResourceLoader.getContent(location).split("[\r\n]+"),
all);
+ } else {
+ loadResources(new String[]{location}, all);
+ }
+ } else {
+ LOG.info("Loading files from: " + location);
+ File file = new File(location);
+ loadFiles(new File[]{file}, all);
+ }
+ }
+
+ // Now that all containers are loaded, we go back through them and merge
+ // recursively. This is done at startup to simplify lookups.
+ for (String container : JSONObject.getNames(all)) {
+ all.put(container, mergeParents(container, all));
+ }
+
+ return all;
+ } catch (IOException e) {
+ throw new ContainerConfigException(e);
+ } catch (JSONException e) {
+ throw new ContainerConfigException(e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return JsonSerializer.serialize(config);
+ }
+
+ private Object evaluateAll(Object value) {
+ if (value instanceof CharSequence) {
+ return value.toString();
+ } else if (value instanceof Map) {
+ ImmutableMap.Builder<Object, Object> newMap = ImmutableMap.builder();
+ for (Map.Entry<?, ?> entry : ((Map<?, ?>) value).entrySet()) {
+ newMap.put(entry.getKey(), evaluateAll(entry.getValue()));
+ }
+
+ return newMap.build();
+ } else if (value instanceof List) {
+ ImmutableList.Builder<Object> newList = ImmutableList.builder();
+ for (Object entry : (List<?>) value){
+ newList.add(evaluateAll(entry));
+ }
+
+ return newList.build();
+ } else {
+ return value;
+ }
+ }
+}
\ No newline at end of file
Deleted:
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js
===================================================================
---
portal/branches/branch-GTNPORTAL-1745/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js 2011-01-10
11:31:22 UTC (rev 5715)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js 2011-09-14
08:37:46 UTC (rev 7405)
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Default container configuration. To change the configuration, you have two options:
-//
-// A. If you run the Java server: Create your own "myContainer.js" file and
-// modify the value in web.xml.
-//
-// B. If you run the PHP server: Create a myContainer.js, copy the contents of
container.js to it,
-// change
-// {"gadgets.container" : ["default"],
-// to
-// {"gadgets.container" : ["myContainer"],
-// And make your changes that you need to myContainer.js.
-// Just make sure on the iframe URL you specify &container=myContainer
-// for it to use that config.
-//
-// All configurations will automatically inherit values from this
-// config, so you only need to provide configuration for items
-// that you require explicit special casing for.
-//
-// Please namespace your attributes using the same conventions
-// as you would for javascript objects, e.g. gadgets.features
-// rather than "features".
-
-// NOTE: Please _don't_ leave trailing commas because the php json parser
-// errors out on this.
-
-// Container must be an array; this allows multiple containers
-// to share configuration.
-{"gadgets.container" : ["default"],
-
-// Set of regular expressions to validate the parent parameter. This is
-// necessary to support situations where you want a single container to support
-// multiple possible host names (such as for localized domains, such as
-// <
language>.example.org. If left as null, the parent parameter will be
-// ignored; otherwise, any requests that do not include a parent
-// value matching this set will return a 404 error.
-"gadgets.parent" : null,
-
-// Should all gadgets be forced on to a locked domain?
-"gadgets.lockedDomainRequired" : false,
-
-// DNS domain on which gadgets should render.
-"gadgets.lockedDomainSuffix" : "-a.example.com:8080",
-
-// Various urls generated throughout the code base.
-// iframeBaseUri will automatically have the host inserted
-// if locked domain is enabled and the implementation supports it.
-// query parameters will be added.
-"gadgets.iframeBaseUri" : "/eXoGadgetServer/gadgets/ifr",
-
-// jsUriTemplate will have %host% and %js% substituted.
-// No locked domain special cases, but jsUriTemplate must
-// never conflict with a lockedDomainSuffix.
-"gadgets.jsUriTemplate" :
"http://%host%/eXoGadgetServer/gadgets/js/%js%",
-
-// Callback URL. Scheme relative URL for easy switch between https/http.
-"gadgets.oauthGadgetCallbackTemplate" :
"//%host%/eXoGadgetServer/gadgets/oauthcallback",
-
-// Use an insecure security token by default
-"gadgets.securityTokenType" : "secure",
-"gadgets.securityTokenKeyFile" : "key.txt",
-
-"gadgets.signingKeyFile" : "oauthkey.pem",
-"gadgets.signingKeyName" : "mytestkey",
-
-"gadgets.signedFetchDomain" : "eXo",
-// Config param to load Opensocial data for social
-// preloads in data pipelining. %host% will be
-// substituted with the current host.
-"gadgets.osDataUri" : "http://%host%/social/rpc",
-
-// Uncomment these to switch to a secure version
-//
-//"gadgets.securityTokenType" : "secure",
-//"gadgets.securityTokenKeyFile" : "/path/to/key/file.txt",
-
-"gadgets.content-rewrite" : {
- "include-urls": ".*",
- "exclude-urls": "",
- "include-tags": ["link", "script", "embed",
"img", "style"],
- "expires": "86400",
- "proxy-url": "/eXoGadgetServer/gadgets/proxy?url=",
- "concat-url": "/eXoGadgetServer/gadgets/concat?"
-},
-
-// This config data will be passed down to javascript. Please
-// configure your object using the feature name rather than
-// the javascript name.
-
-// Only configuration for required features will be used.
-// See individual feature.xml files for configuration details.
-"gadgets.features" : {
- "core.io" : {
- // Note: /proxy is an open proxy. Be careful how you expose this!
- "proxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/proxy?refresh=%refresh%&url=%url%",
- "jsonProxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/makeRequest"
- },
- "views" : {
- "home" : {
- "isOnlyVisible" : false,
- "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/home?{var}",
- "aliases": ["DASHBOARD", "default"]
- },
- "canvas" : {
- "isOnlyVisible" : true,
- "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/canvas?{var}",
- "aliases" : ["FULL_PAGE"]
- }
- },
- "rpc" : {
- // Path to the relay file. Automatically appended to the parent
- /// parameter if it passes input validation and is not null.
- // This should never be on the same host in a production environment!
- // Only use this for TESTING!
- "parentRelayUrl" :
"/eXoGadgetServer/gadgets/files/container/rpc_relay.html",
-
- // If true, this will use the legacy ifpc wire format when making rpc
- // requests.
- "useLegacyProtocol" : false
- },
- // Skin defaults
- "skins" : {
- "properties" : {
- "BG_COLOR": "",
- "BG_IMAGE": "",
- "BG_POSITION": "",
- "BG_REPEAT": "",
- "FONT_COLOR": "",
- "ANCHOR_COLOR": ""
- }
- },
- "opensocial-0.8" : {
- // Path to fetch opensocial data from
- // Must be on the same domain as the gadget rendering server
- "path" : "http://%host%/social",
- "domain" : "shindig",
- "enableCaja" : false,
- "supportedFields" : {
- "person" : ["id", {"name" : ["familyName",
"givenName", "unstructured"]}, "thumbnailUrl",
"profileUrl"],
- "activity" : ["id", "title"]
- }
- },
- "osapi.services" : {
- // Specifying a binding to "container.listMethods" instructs osapi to
dynamicaly introspect the services
- // provided by the container and delay the gadget onLoad handler until that
introspection is
- // complete.
- // Alternatively a container can directly configure services here rather than having
them
- // introspected. Simply list out the available servies and omit
"container.listMethods" to
- // avoid the initialization delay caused by gadgets.rpc
- // E.g. "gadgets.rpc" : ["activities.requestCreate",
"messages.requestSend", "requestShareApp",
"requestPermission"]
- "gadgets.rpc" : ["container.listMethods"]
- },
-// "osapi" : {
-// // The endpoints to query for available JSONRPC/REST services
-// "endPoints" : [ "http://%host%/social/rpc",
"http://%host%/gadgets/api/rpc" ]
-// },
- "osml": {
- // OSML library resource. Can be set to null or the empty string to disable OSML
- // for a container.
- "library": ""
- }
-}}
Copied:
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js
(from rev 5715,
portal/branches/branch-GTNPORTAL-1745/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/classes/containers/default/container.js 2011-09-14
08:37:46 UTC (rev 7405)
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Default container configuration. To change the configuration, you have two options:
+//
+// A. If you run the Java server: Create your own "myContainer.js" file and
+// modify the value in web.xml.
+//
+// B. If you run the PHP server: Create a myContainer.js, copy the contents of
container.js to it,
+// change
+// {"gadgets.container" : ["default"],
+// to
+// {"gadgets.container" : ["myContainer"],
+// And make your changes that you need to myContainer.js.
+// Just make sure on the iframe URL you specify &container=myContainer
+// for it to use that config.
+//
+// All configurations will automatically inherit values from this
+// config, so you only need to provide configuration for items
+// that you require explicit special casing for.
+//
+// Please namespace your attributes using the same conventions
+// as you would for javascript objects, e.g. gadgets.features
+// rather than "features".
+
+// NOTE: Please _don't_ leave trailing commas because the php json parser
+// errors out on this.
+
+// Container must be an array; this allows multiple containers
+// to share configuration.
+{"gadgets.container" : ["default"],
+
+// Set of regular expressions to validate the parent parameter. This is
+// necessary to support situations where you want a single container to support
+// multiple possible host names (such as for localized domains, such as
+// <
language>.example.org. If left as null, the parent parameter will be
+// ignored; otherwise, any requests that do not include a parent
+// value matching this set will return a 404 error.
+"gadgets.parent" : null,
+
+// Should all gadgets be forced on to a locked domain?
+"gadgets.lockedDomainRequired" : false,
+
+// DNS domain on which gadgets should render.
+"gadgets.lockedDomainSuffix" : "-a.example.com:8080",
+
+// Various urls generated throughout the code base.
+// iframeBaseUri will automatically have the host inserted
+// if locked domain is enabled and the implementation supports it.
+// query parameters will be added.
+"gadgets.iframeBaseUri" : "/eXoGadgetServer/gadgets/ifr",
+
+// jsUriTemplate will have %host% and %js% substituted.
+// No locked domain special cases, but jsUriTemplate must
+// never conflict with a lockedDomainSuffix.
+"gadgets.jsUriTemplate" :
"http://%host%/eXoGadgetServer/gadgets/js/%js%",
+
+// Callback URL. Scheme relative URL for easy switch between https/http.
+"gadgets.oauthGadgetCallbackTemplate" :
"//%host%/eXoGadgetServer/gadgets/oauthcallback",
+
+// Use an insecure security token by default
+"gadgets.securityTokenType" : "secure",
+"gadgets.securityTokenKeyFile" : "key.txt",
+
+"gadgets.signingKeyFile" : "oauthkey.pem",
+"gadgets.signingKeyName" : "mytestkey",
+
+"gadgets.signedFetchDomain" : "eXo",
+// Config param to load Opensocial data for social
+// preloads in data pipelining. %host% will be
+// substituted with the current host.
+"gadgets.osDataUri" : "http://%host%/social/rpc",
+
+// Uncomment these to switch to a secure version
+//
+//"gadgets.securityTokenType" : "secure",
+//"gadgets.securityTokenKeyFile" : "/path/to/key/file.txt",
+
+"gadgets.content-rewrite" : {
+ "include-urls": ".*",
+ "exclude-urls": "",
+ "include-tags": ["link", "script", "embed",
"img", "style"],
+ "expires": "86400",
+ "proxy-url": "/eXoGadgetServer/gadgets/proxy?url=",
+ "concat-url": "/eXoGadgetServer/gadgets/concat?"
+},
+
+// This config data will be passed down to javascript. Please
+// configure your object using the feature name rather than
+// the javascript name.
+
+// Only configuration for required features will be used.
+// See individual feature.xml files for configuration details.
+"gadgets.features" : {
+ "core.io" : {
+ // Note: /proxy is an open proxy. Be careful how you expose this!
+ "proxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/proxy?refresh=%refresh%&url=%url%",
+ "jsonProxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/makeRequest"
+ },
+ "views" : {
+ "home" : {
+ "isOnlyVisible" : false,
+ "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/home?{var}",
+ "aliases": ["DASHBOARD", "default"]
+ },
+ "canvas" : {
+ "isOnlyVisible" : true,
+ "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/canvas?{var}",
+ "aliases" : ["FULL_PAGE"]
+ }
+ },
+ "rpc" : {
+ // Path to the relay file. Automatically appended to the parent
+ /// parameter if it passes input validation and is not null.
+ // This should never be on the same host in a production environment!
+ // Only use this for TESTING!
+ "parentRelayUrl" :
"/eXoGadgetServer/gadgets/files/container/rpc_relay.html",
+
+ // If true, this will use the legacy ifpc wire format when making rpc
+ // requests.
+ "useLegacyProtocol" : false
+ },
+ // Skin defaults
+ "skins" : {
+ "properties" : {
+ "BG_COLOR": "",
+ "BG_IMAGE": "",
+ "BG_POSITION": "",
+ "BG_REPEAT": "",
+ "FONT_COLOR": "",
+ "ANCHOR_COLOR": ""
+ }
+ },
+ "opensocial-0.8" : {
+ // Path to fetch opensocial data from
+ // Must be on the same domain as the gadget rendering server
+ "path" : "http://%host%/social",
+ "domain" : "shindig",
+ "enableCaja" : false,
+ "supportedFields" : {
+ "person" : ["id", {"name" : ["familyName",
"givenName", "unstructured"]}, "thumbnailUrl",
"profileUrl"],
+ "activity" : ["id", "title"]
+ }
+ },
+ "osapi.services" : {
+ // Specifying a binding to "container.listMethods" instructs osapi to
dynamicaly introspect the services
+ // provided by the container and delay the gadget onLoad handler until that
introspection is
+ // complete.
+ // Alternatively a container can directly configure services here rather than having
them
+ // introspected. Simply list out the available servies and omit
"container.listMethods" to
+ // avoid the initialization delay caused by gadgets.rpc
+ // E.g. "gadgets.rpc" : ["activities.requestCreate",
"messages.requestSend", "requestShareApp",
"requestPermission"]
+ "gadgets.rpc" : ["container.listMethods"]
+ },
+// "osapi" : {
+// // The endpoints to query for available JSONRPC/REST services
+// "endPoints" : [ "http://%host%/social/rpc",
"http://%host%/gadgets/api/rpc" ]
+// },
+ "osml": {
+ // OSML library resource. Can be set to null or the empty string to disable OSML
+ // for a container.
+ "library": ""
+ }
+}}
Modified:
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml 2011-09-14
08:05:34 UTC (rev 7404)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml 2011-09-14
08:37:46 UTC (rev 7405)
@@ -94,7 +94,8 @@
</filter-mapping>
<listener>
-
<listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class>
+
<!--<listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class>-->
+
<listener-class>org.exoplatform.portal.gadget.core.GateInGuiceServletContextListener</listener-class>
</listener>
<!-- Render a Gadget -->
Deleted:
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js
===================================================================
---
portal/branches/branch-GTNPORTAL-1745/gadgets/server/src/main/webapp/containers/default/container.js 2011-01-17
05:02:04 UTC (rev 5761)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js 2011-09-14
08:37:46 UTC (rev 7405)
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Default container configuration. To change the configuration, you have two options:
-//
-// A. If you run the Java server: Create your own "myContainer.js" file and
-// modify the value in web.xml.
-//
-// B. If you run the PHP server: Create a myContainer.js, copy the contents of
container.js to it,
-// change
-// {"gadgets.container" : ["default"],
-// to
-// {"gadgets.container" : ["myContainer"],
-// And make your changes that you need to myContainer.js.
-// Just make sure on the iframe URL you specify &container=myContainer
-// for it to use that config.
-//
-// All configurations will automatically inherit values from this
-// config, so you only need to provide configuration for items
-// that you require explicit special casing for.
-//
-// Please namespace your attributes using the same conventions
-// as you would for javascript objects, e.g. gadgets.features
-// rather than "features".
-
-// NOTE: Please _don't_ leave trailing commas because the php json parser
-// errors out on this.
-
-// Container must be an array; this allows multiple containers
-// to share configuration.
-{"gadgets.container" : ["default"],
-
-// Set of regular expressions to validate the parent parameter. This is
-// necessary to support situations where you want a single container to support
-// multiple possible host names (such as for localized domains, such as
-// <
language>.example.org. If left as null, the parent parameter will be
-// ignored; otherwise, any requests that do not include a parent
-// value matching this set will return a 404 error.
-"gadgets.parent" : null,
-
-// Should all gadgets be forced on to a locked domain?
-"gadgets.lockedDomainRequired" : false,
-
-// DNS domain on which gadgets should render.
-"gadgets.lockedDomainSuffix" : "-a.example.com:8080",
-
-// Various urls generated throughout the code base.
-// iframeBaseUri will automatically have the host inserted
-// if locked domain is enabled and the implementation supports it.
-// query parameters will be added.
-"gadgets.iframeBaseUri" : "/eXoGadgetServer/gadgets/ifr",
-
-// jsUriTemplate will have %host% and %js% substituted.
-// No locked domain special cases, but jsUriTemplate must
-// never conflict with a lockedDomainSuffix.
-"gadgets.jsUriTemplate" :
"http://%host%/eXoGadgetServer/gadgets/js/%js%",
-
-// Callback URL. Scheme relative URL for easy switch between https/http.
-"gadgets.oauthGadgetCallbackTemplate" :
"//%host%/eXoGadgetServer/gadgets/oauthcallback",
-
-// Use an insecure security token by default
-"gadgets.securityTokenType" : "secure",
-"gadgets.securityTokenKeyFile" : "key.txt",
-
-"gadgets.signingKeyFile" : "oauthkey.pem",
-"gadgets.signingKeyName" : "mytestkey",
-
-"gadgets.signedFetchDomain" : "eXo",
-// Config param to load Opensocial data for social
-// preloads in data pipelining. %host% will be
-// substituted with the current host.
-"gadgets.osDataUri" : "http://%host%/social/rpc",
-
-// Uncomment these to switch to a secure version
-//
-//"gadgets.securityTokenType" : "secure",
-//"gadgets.securityTokenKeyFile" : "/path/to/key/file.txt",
-
-"gadgets.content-rewrite" : {
- "include-urls": ".*",
- "exclude-urls": "",
- "include-tags": ["link", "script", "embed",
"img", "style"],
- "expires": "86400",
- "proxy-url": "/eXoGadgetServer/gadgets/proxy?url=",
- "concat-url": "/eXoGadgetServer/gadgets/concat?"
-},
-
-// This config data will be passed down to javascript. Please
-// configure your object using the feature name rather than
-// the javascript name.
-
-// Only configuration for required features will be used.
-// See individual feature.xml files for configuration details.
-"gadgets.features" : {
- "core.io" : {
- // Note: /proxy is an open proxy. Be careful how you expose this!
- "proxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/proxy?refresh=%refresh%&url=%url%",
- "jsonProxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/makeRequest"
- },
- "views" : {
- "home" : {
- "isOnlyVisible" : false,
- "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/home?{var}",
- "aliases": ["DASHBOARD", "default"]
- },
- "canvas" : {
- "isOnlyVisible" : true,
- "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/canvas?{var}",
- "aliases" : ["FULL_PAGE"]
- }
- },
- "rpc" : {
- // Path to the relay file. Automatically appended to the parent
- /// parameter if it passes input validation and is not null.
- // This should never be on the same host in a production environment!
- // Only use this for TESTING!
- "parentRelayUrl" :
"/eXoGadgetServer/gadgets/files/container/rpc_relay.html",
-
- // If true, this will use the legacy ifpc wire format when making rpc
- // requests.
- "useLegacyProtocol" : false
- },
- // Skin defaults
- "skins" : {
- "properties" : {
- "BG_COLOR": "",
- "BG_IMAGE": "",
- "BG_POSITION": "",
- "BG_REPEAT": "",
- "FONT_COLOR": "",
- "ANCHOR_COLOR": ""
- }
- },
- "opensocial-0.8" : {
- // Path to fetch opensocial data from
- // Must be on the same domain as the gadget rendering server
- "path" : "http://%host%/social",
- "domain" : "shindig",
- "enableCaja" : false,
- "supportedFields" : {
- "person" : ["id", {"name" : ["familyName",
"givenName", "unstructured"]}, "thumbnailUrl",
"profileUrl"],
- "activity" : ["id", "title"]
- }
- },
- "osapi.services" : {
- // Specifying a binding to "container.listMethods" instructs osapi to
dynamicaly introspect the services
- // provided by the container and delay the gadget onLoad handler until that
introspection is
- // complete.
- // Alternatively a container can directly configure services here rather than having
them
- // introspected. Simply list out the available servies and omit
"container.listMethods" to
- // avoid the initialization delay caused by gadgets.rpc
- // E.g. "gadgets.rpc" : ["activities.requestCreate",
"messages.requestSend", "requestShareApp",
"requestPermission"]
- "gadgets.rpc" : ["container.listMethods"]
- },
-// "osapi" : {
-// // The endpoints to query for available JSONRPC/REST services
-// "endPoints" : [ "http://%host%/social/rpc",
"http://%host%/gadgets/api/rpc" ]
-// },
- "osml": {
- // OSML library resource. Can be set to null or the empty string to disable OSML
- // for a container.
- "library": ""
- }
-}}
Copied:
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js
(from rev 5761,
portal/branches/branch-GTNPORTAL-1745/gadgets/server/src/main/webapp/containers/default/container.js)
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js
(rev 0)
+++
epp/portal/branches/EPP_5_2_Branch/gadgets/server/src/main/webapp/containers/default/container.js 2011-09-14
08:37:46 UTC (rev 7405)
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Default container configuration. To change the configuration, you have two options:
+//
+// A. If you run the Java server: Create your own "myContainer.js" file and
+// modify the value in web.xml.
+//
+// B. If you run the PHP server: Create a myContainer.js, copy the contents of
container.js to it,
+// change
+// {"gadgets.container" : ["default"],
+// to
+// {"gadgets.container" : ["myContainer"],
+// And make your changes that you need to myContainer.js.
+// Just make sure on the iframe URL you specify &container=myContainer
+// for it to use that config.
+//
+// All configurations will automatically inherit values from this
+// config, so you only need to provide configuration for items
+// that you require explicit special casing for.
+//
+// Please namespace your attributes using the same conventions
+// as you would for javascript objects, e.g. gadgets.features
+// rather than "features".
+
+// NOTE: Please _don't_ leave trailing commas because the php json parser
+// errors out on this.
+
+// Container must be an array; this allows multiple containers
+// to share configuration.
+{"gadgets.container" : ["default"],
+
+// Set of regular expressions to validate the parent parameter. This is
+// necessary to support situations where you want a single container to support
+// multiple possible host names (such as for localized domains, such as
+// <
language>.example.org. If left as null, the parent parameter will be
+// ignored; otherwise, any requests that do not include a parent
+// value matching this set will return a 404 error.
+"gadgets.parent" : null,
+
+// Should all gadgets be forced on to a locked domain?
+"gadgets.lockedDomainRequired" : false,
+
+// DNS domain on which gadgets should render.
+"gadgets.lockedDomainSuffix" : "-a.example.com:8080",
+
+// Various urls generated throughout the code base.
+// iframeBaseUri will automatically have the host inserted
+// if locked domain is enabled and the implementation supports it.
+// query parameters will be added.
+"gadgets.iframeBaseUri" : "/eXoGadgetServer/gadgets/ifr",
+
+// jsUriTemplate will have %host% and %js% substituted.
+// No locked domain special cases, but jsUriTemplate must
+// never conflict with a lockedDomainSuffix.
+"gadgets.jsUriTemplate" :
"http://%host%/eXoGadgetServer/gadgets/js/%js%",
+
+// Callback URL. Scheme relative URL for easy switch between https/http.
+"gadgets.oauthGadgetCallbackTemplate" :
"//%host%/eXoGadgetServer/gadgets/oauthcallback",
+
+// Use an insecure security token by default
+"gadgets.securityTokenType" : "secure",
+"gadgets.securityTokenKeyFile" : "key.txt",
+
+"gadgets.signingKeyFile" : "oauthkey.pem",
+"gadgets.signingKeyName" : "mytestkey",
+
+"gadgets.signedFetchDomain" : "eXo",
+// Config param to load Opensocial data for social
+// preloads in data pipelining. %host% will be
+// substituted with the current host.
+"gadgets.osDataUri" : "http://%host%/social/rpc",
+
+// Uncomment these to switch to a secure version
+//
+//"gadgets.securityTokenType" : "secure",
+//"gadgets.securityTokenKeyFile" : "/path/to/key/file.txt",
+
+"gadgets.content-rewrite" : {
+ "include-urls": ".*",
+ "exclude-urls": "",
+ "include-tags": ["link", "script", "embed",
"img", "style"],
+ "expires": "86400",
+ "proxy-url": "/eXoGadgetServer/gadgets/proxy?url=",
+ "concat-url": "/eXoGadgetServer/gadgets/concat?"
+},
+
+// This config data will be passed down to javascript. Please
+// configure your object using the feature name rather than
+// the javascript name.
+
+// Only configuration for required features will be used.
+// See individual feature.xml files for configuration details.
+"gadgets.features" : {
+ "core.io" : {
+ // Note: /proxy is an open proxy. Be careful how you expose this!
+ "proxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/proxy?refresh=%refresh%&url=%url%",
+ "jsonProxyUrl" :
"http://%host%/eXoGadgetServer/gadgets/makeRequest"
+ },
+ "views" : {
+ "home" : {
+ "isOnlyVisible" : false,
+ "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/home?{var}",
+ "aliases": ["DASHBOARD", "default"]
+ },
+ "canvas" : {
+ "isOnlyVisible" : true,
+ "urlTemplate" :
"http://%host%/eXoGadgetServer/gadgets/canvas?{var}",
+ "aliases" : ["FULL_PAGE"]
+ }
+ },
+ "rpc" : {
+ // Path to the relay file. Automatically appended to the parent
+ /// parameter if it passes input validation and is not null.
+ // This should never be on the same host in a production environment!
+ // Only use this for TESTING!
+ "parentRelayUrl" :
"/eXoGadgetServer/gadgets/files/container/rpc_relay.html",
+
+ // If true, this will use the legacy ifpc wire format when making rpc
+ // requests.
+ "useLegacyProtocol" : false
+ },
+ // Skin defaults
+ "skins" : {
+ "properties" : {
+ "BG_COLOR": "",
+ "BG_IMAGE": "",
+ "BG_POSITION": "",
+ "BG_REPEAT": "",
+ "FONT_COLOR": "",
+ "ANCHOR_COLOR": ""
+ }
+ },
+ "opensocial-0.8" : {
+ // Path to fetch opensocial data from
+ // Must be on the same domain as the gadget rendering server
+ "path" : "http://%host%/social",
+ "domain" : "shindig",
+ "enableCaja" : false,
+ "supportedFields" : {
+ "person" : ["id", {"name" : ["familyName",
"givenName", "unstructured"]}, "thumbnailUrl",
"profileUrl"],
+ "activity" : ["id", "title"]
+ }
+ },
+ "osapi.services" : {
+ // Specifying a binding to "container.listMethods" instructs osapi to
dynamicaly introspect the services
+ // provided by the container and delay the gadget onLoad handler until that
introspection is
+ // complete.
+ // Alternatively a container can directly configure services here rather than having
them
+ // introspected. Simply list out the available servies and omit
"container.listMethods" to
+ // avoid the initialization delay caused by gadgets.rpc
+ // E.g. "gadgets.rpc" : ["activities.requestCreate",
"messages.requestSend", "requestShareApp",
"requestPermission"]
+ "gadgets.rpc" : ["container.listMethods"]
+ },
+// "osapi" : {
+// // The endpoints to query for available JSONRPC/REST services
+// "endPoints" : [ "http://%host%/social/rpc",
"http://%host%/gadgets/api/rpc" ]
+// },
+ "osml": {
+ // OSML library resource. Can be set to null or the empty string to disable OSML
+ // for a container.
+ "library": ""
+ }
+}}