updated opensocial environment to be compatible with requirejs

git-svn-id: https://svn.apache.org/repos/asf/rave/branches/require@1500059 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp b/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
index d186c42..bea9414 100644
--- a/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
+++ b/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
@@ -1,4 +1,3 @@
-w
 <%@ taglib prefix="portal" uri="http://www.apache.org/rave/tags" %>
 <%--
   Licensed to the Apache Software Foundation (ASF) under one
diff --git a/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag b/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
index 40a244e..79cdf08 100644
--- a/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
+++ b/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
@@ -21,11 +21,6 @@
 <portal:render-script location="${'BEFORE_LIB'}"/>

 <rave:third_party_js/>

 <portal:render-script location="${'AFTER_LIB'}"/>

-<%-- local rave scripts --%>

-<portal:render-script location="${'BEFORE_RAVE'}"/>

-<%-- get the javaScriptDebugMode portal preference value --%>

-<c:set var="jsDebugMode"><portal:render-js-debug-mode/></c:set>

-<%-- check to see if the javaScriptDebugMode is on, if so render the individual JS files, otherwise render the minified single file --%>

 <c:choose>

     <c:when test="${jsDebugMode == '1'}">

         <script src="<spring:url value="/static/script/requireConfig.js"/>"></script>

@@ -40,6 +35,13 @@
         </script>

     </c:otherwise>

 </c:choose>

+

+<%-- local rave scripts --%>

+<portal:render-script location="${'BEFORE_RAVE'}"/>

+<%-- get the javaScriptDebugMode portal preference value --%>

+<c:set var="jsDebugMode"><portal:render-js-debug-mode/></c:set>

+<%-- check to see if the javaScriptDebugMode is on, if so render the individual JS files, otherwise render the minified single file --%>

+

 <script>

     require(["rave", "jquery"], function (rave, $) {

         <%-- set the web application context --%>

diff --git a/rave-portal-resources/src/main/webapp/static/script/requireConfig.js b/rave-portal-resources/src/main/webapp/static/script/requireConfig.js
index 9e1f7ba..1b550c1 100644
--- a/rave-portal-resources/src/main/webapp/static/script/requireConfig.js
+++ b/rave-portal-resources/src/main/webapp/static/script/requireConfig.js
@@ -30,7 +30,7 @@
         "jqueryValidate":"//ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min",
         "jqueryHashChange":'//cdnjs.cloudflare.com/ajax/libs/jquery-hashchange/v1.3/jquery.ba-hashchange.min',
         "jqueryTouchPouch": '//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min',
-        "osapi":"/gadgets/js/container:pubsub-2:open-views.js?c=1&container=default&debug=1",
+        "osapi":"//placeholder.url.will.be.replaced.by.opensocial.environment",
         "rave": "core/main",
         "ui": "portal/main",
         "underscore": "//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min"
diff --git a/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java b/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java
index 065fe8a..718829f 100644
--- a/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java
+++ b/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java
@@ -45,7 +45,7 @@
 
     private static final String CONTAINER_JS_KEY = "containerJs";
     private static final String SCRIPT_RENDER_DEBUG_ON = "1";
-    private final static String SCRIPT_TEMPLATE = "<script src=\"%1$s://%2$s%3$s/js/%4$s.js?c=1&amp;container=default&amp;debug=%5$s\"></script>";
+    private final static String SCRIPT_TEMPLATE = "<script>requirejs.config({paths: {\"osapi\":\"%1$s://%2$s%3$s/js/%4$s.js?c=1&amp;container=default&amp;debug=%5$s\"}});</script>";
 
     private String currentDebugMode;