Author: keith
Date: Thu Jul 17 11:44:53 2008
New Revision: 19433
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19433

Log:
Setting stub-location and wsrequest-location to use absolute http URLS when 
googlegadget is used


Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TemplateProcessor.java

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TemplateProcessor.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TemplateProcessor.java?rev=19433&r1=19432&r2=19433&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TemplateProcessor.java
  (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/requestprocessor/TemplateProcessor.java
  Thu Jul 17 11:44:53 2008
@@ -18,6 +18,7 @@
 import org.wso2.wsas.transport.HttpGetRequestProcessor;
 import org.wso2.mashup.utils.MashupUtils;
 import org.wso2.mashup.MashupConstants;
+import org.wso2.adminui.AdminUIServletContextListener;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.axis2.context.ConfigurationContext;
@@ -162,10 +163,24 @@
                     transformer.setParameter("localhost-endpoints", "true");
                 }
 
-//                transformer.setParameter("wsrequest-location", 
"../../js/wso2/WSRequest.js");
-                // Performing the XSLT transformation
-                transformer.transform(xmlSource, result);
-                
+                if ("googlegadget".equalsIgnoreCase(flavorParameter)) {
+                    String httpUrl = 
MashupUtils.getServerURL(request.getServerName());
+                    String contextRoot = 
AdminUIServletContextListener.contextPath;
+                    if (!contextRoot.endsWith(MashupConstants.FORWARD_SLASH)) {
+                        contextRoot = contextRoot + 
MashupConstants.FORWARD_SLASH;
+                    }
+                    transformer.setParameter("wsrequest-location",
+                                         httpUrl + contextRoot + 
"js/wso2/WSRequest.js");
+                    String mashupServerURL = contextRoot + 
configurationContext.getServicePath() +
+                            MashupConstants.FORWARD_SLASH;
+                    transformer.setParameter("stub-location",
+                                         httpUrl + mashupServerURL + 
serviceName.replace(
+                                                     
MashupConstants.SEPARATOR_CHAR,
+                                                     
MashupConstants.FORWARD_SLASH) + "?stub");
+                    // Performing the XSLT transformation
+                    transformer.transform(xmlSource, result);
+                }
+
             } else {
                 response.setContentType("text/html");
                 response.setStatus(HttpServletResponse.SC_NOT_FOUND);

_______________________________________________
Mashup-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to